Page 1 of 1

How do you get lines from a file.

Posted: Mon Jun 29, 2009 2:29 am
by albert
I`m wondering how do you line input data from a file??

How do you get lines from a file.

Posted: Mon Jun 29, 2009 7:14 am
by fred
You ?can use the object FileStream

as an example a small program i use:

dim filenaam as string
dim f as FileStream
dim regel as string

filenaam = Trim$(Command$)
const fnxlog="fnx.log"

if FileExists(fnxlog)=true then
?print filenaam
?f.Open(fnxlog)
?while f.Position < f.Size
? ?regel=f.ReadLine
? ?if Left$(regel,6)="error:" then
? ? ?print filenaam+":"+regel
? ?else
? ? ?print regel
? ?end if
?wend
?f.Close
end if

Instead of while f.Position < f.Size you could use f.LineCount in a for loop


How do you get lines from a file.

Posted: Mon Jun 29, 2009 8:56 pm
by albert
I got it working it in my program Cyph256V2 over on the files page under SillyCypher. its the last one on the page.