check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file
check line and read the rest of txt file check line and read the rest of txt file
check line and read the rest of txt file
Go Back  Xtreme Visual Basic Talk > > > check line and read the rest of txt file


Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2015, 12:49 PM
sal21 sal21 is offline
Junior Contributor
 
Join Date: Mar 2004
Posts: 260
Default check line and read the rest of txt file


I need to check if in a Mid position of line in a txt file have "TEST0001".

... and from here read the rest of file,

Possible without the read line by line...

i have a txt file with approx 4.000.000 lines!
Reply With Quote
  #2  
Old 10-01-2015, 01:10 AM
fafalone fafalone is offline
Freshman
 
Join Date: May 2010
Posts: 37
Default

You can start reading from a particular position, but the only way to specify that is by bytes; doing it by linebreaks would require counting the linebreaks. If you're sure it won't be in the first 50% or whatever, by bytes, you could do it that way.

Open sFile For Binary As #hFile 'hFile is FreeFile() result

Then you use the Get statement; the second argument of which isn't typically used but actually specifies the starting position. So if you set it to, for example LOF(file) \ 2 (length of file divided by 2), you'd only get the second half of the file.

The more certain you are, the more you can narrow down where to start looking from. If you're not certain at all where in the file your string will be, you're just going to have to search the whole thing.

..if you're not already familiar with open/get/lof etc, here's a good article on basic file i/o: File Handling In Visual Basic 6 Part 1 - Sequential Files - Visual Basic Tutorials | Dream.In.Code (part 1) and File Handling In Visual Basic 6 Part 2 - Binary File Handling - Visual Basic Tutorials | Dream.In.Code (part 2)
Reply With Quote
Reply

Tags
check, file, line, read, txt, rest


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file check line and read the rest of txt file
check line and read the rest of txt file
check line and read the rest of txt file
 
check line and read the rest of txt file
check line and read the rest of txt file
 
-->