Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Read Characters

Status
Not open for further replies.

codenovice

IS-IT--Management
Dec 4, 2001
11
US
Hi!!!
I have a list of characters in afile but I need to read line by line
12 11 02 0.000067D-07-1.2345677 0.0000000001

I would like to read the entire line comprising 12 11 02 ...
The problem is that I have it in a text file. I have couple of more lines below this line. So I need to read like 5 lines.

Please Help me and It is Very Urgent.

Thanks
 
Hi codenovice

Line Input

Open strFileName For Input As #1
For intSt = 0 To 4
Line Input #1, strString
Next
Close #1

Jon
 
Or you could just open the file

Open fileName For Input As #1

and use the Split function to separate each line

yourArray() = Split(fileName, vbcrlf)

This may be more efficient if you are not always certain of how many lines you are reading in. If you are always sure it will be 5 then either way will still work.
 
You could use the "Line Input" even if you don't know how many lines you are reading in.
Just use "do loop" and EOF. - This loops until the End Of the File.

Open strFileName For Input As #1
Do until EOF(#1)
Line Input #1, strString
Loop
Close #1


Daniel ---------------------------------------
Visit me @:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top