Computing.Net > Forums > Programming > vbscript read line in the middle

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

vbscript read line in the middle

Reply to Message Icon

Original Message
Name: dougchiu
Date: January 9, 2008 at 19:21:29 Pacific
Subject: vbscript read line in the middle
OS: Windows2000
CPU/Ram: 2
Model/Manufacturer: MS
Comment:

Hi
I want to have a vbscript to read text file start from the middle of the file. e.g. each time read the file and skip the first 5 lines and start from sixth line until the end of file.
how can i do it?
Thank you for your help~!



Report Offensive Message For Removal


Response Number 1
Name: Razor2.3
Date: January 9, 2008 at 19:31:53 Pacific
Reply: (edit)

Just add a loop after you open the file and throw away the first five lines.

'Assuming your file stream is called oFileIn...
Dim i
For i = 1 To 5
oFileIn.ReadLine
Next


Report Offensive Follow Up For Removal

Response Number 2
Name: dougchiu
Date: January 9, 2008 at 20:16:51 Pacific
Reply: (edit)

oFileIn.ReadLine <- which means to throw away the text it read??


Report Offensive Follow Up For Removal

Response Number 3
Name: Razor2.3
Date: January 9, 2008 at 21:49:21 Pacific
Reply: (edit)

It reads the next line, then returns a string. Because we're not doing anything with the returned string, we throw away the text.


Report Offensive Follow Up For Removal

Response Number 4
Name: dougchiu
Date: January 10, 2008 at 23:56:32 Pacific
Reply: (edit)

yes,i've got it.
Thank you very much~!


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software