End of file when using readln ? (javascript eof)

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
berniebernie
Posts: 33
Joined: February 7th, 2005, 7:32 am
Contact:

Hello all

I'm using readln to parse a text file line by line (I'd rather not use 'read' if ever I parse a large file), however I have no idea how to catch the end of the file:

Code: Select all

    var myFile = File.openDialog ("Select file","*.txt"); 
    var fileOK = myFile.open("r","TEXT","????");
    while(t = myFile.readln()){
		//alert(t) or whatever
};
The script stops if there's a blank line (two linebreaks).

Any ideas ? Short of using read?
Boom boom boom.
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Like this:

Code: Select all

while(! myFile.eof){
      t = myFile.readln();
      //alert(t) or whatever
};
Dan
berniebernie
Posts: 33
Joined: February 7th, 2005, 7:32 am
Contact:

Thank you Dan Ebberts!
Boom boom boom.
Post Reply