Link to home
Start Free TrialLog in
Avatar of tina2009
tina2009

asked on

jump directly to the line 457478

sorry for my bad English.


i have a text with 132 fixed length lines.

i need to jump directly to the line number 457478.

but not with the a loop line by line... i know this way, i need to jump directly the line  457478.

Now after the code is in line number 457478, read, line-by-line, the rest of text to the end of text

Note:
The text file has approx 4500000 (4.5M) lines and the file size is approx 533 MB
Avatar of aikimark
aikimark
Flag of United States of America image

@tina2009

Since these are fixed length lines, you have at least two solutions.
VB instrinsic solution 1
Open the file as Input
Calculate the position in the file = (record size * 457478)
Use the Seek statement to position the 'cursor' in the file
Use Line Input statement to read the rest of the file

VB instrinsic solution 2
Open the file as Binary or Random
Calculate the position in the file = (record size * 457478)
Use the Get statement to position the 'cursor' in the file
Use Get statement to read the rest of the file

FileSystemObject solution
Open the file and instantiate a textstream object
Calculate the position in the file = (record size * 457478)
Use the textstream's Skip method to position the 'cursor' in the file
Use textstream's readline method to read the rest of the file
Avatar of tina2009
tina2009

ASKER

not for me....:-(

can you post a simple code for all ttree possible solution?
Tks.
Do you know how to program/code?
Sure! but my knoledgment of vb6 not is so advanced:-)
With what programming languages are you familiar?

Have you pressed F1 and read the help text for the Open statement or Line Input statement or the Seek statement?

Have you done an online search of the FileSystemObject or the TextStream object?

can you post a simple code for all ttree possible solution?
While I could do that, I'm not going to.  I might post one, but I don't know the context/application in which you are coding.

Some effort on your part will go a long way when working with the experts.

The volunteer experts are here to help you.  If you need a professional to do all the work for you, look at the top experts in the VB zone and see if any of them have enabled their Hire Me link.
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No good devolution...
blahhnh
I don't understand your comment