471,049 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

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 1444
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.

Similar topics

22 posts views Thread by edgrsprj | last post: by
6 posts views Thread by sathyashrayan | last post: by
42 posts views Thread by mellyshum123 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.