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:

April 6th, 2010, 1:51 pm

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: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

April 6th, 2010, 10:24 pm

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:

April 7th, 2010, 1:14 am

Thank you Dan Ebberts!
Boom boom boom.
Post Reply