468,733 Members | 1,206 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,733 developers. It's quick & easy.

VB 2005 question regarding reading text files

Hi there,

I am writing a code to read some data from the text files. The number of text files is not fixed and could be more that 15. the length of each file is large... close to 100,000 on an average. some of them are extra large. The data that I have to read will always be at the bottom and will be in the last 5 -20 line in the files depending upon their size. small files will have 5 line and large files will have 20 lines to read.

Can you people suggest me an easy way to do it. If I read all the files from top and look for a particular word to start storing data..with 15 file it will take a lot of time.

is there are way to read from bottom... or count the number of line and start reading from no. of line - 20....

or any other easy ways??

please let me know..

thanks... please keep in mind that i am a begineer...
Jul 26 '07 #1
1 1362
Killer42
8,435 Expert 8TB
You could start at the end of the file and jump back a bit repeatedly until you find the start of the line you want. When you open a file in Binary mode, you can skip around to any point in the file.

Are the last 5/20 lines of a fixed size? Do you know what their maximum size is?

I'd throw together some code to try out the idea, but I'm VB6, and I think the file handling is somewhat different in VB.Net.
Jul 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.