www.digitalmars.com         C & C++   DMDScript  

DMDScript - readln() - how to detect EOF vs. a blank line?

reply ed_davis2 at yahoo.com <ed_davis2_member pathlink.com> writes:
Using the stand-alone version of dscript, how do you tell when there is no more
standard input, as in:

ds foo.js <file.txt

Thanks!
Dec 29 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"ed_davis2 at yahoo.com" <ed_davis2_member pathlink.com> wrote in message
news:cqv0he$1f2e$1 digitaldaemon.com...
 Using the stand-alone version of dscript, how do you tell when there is no
more
 standard input, as in:

 ds foo.js <file.txt
There currently isn't a way. I should probably fix that!
Jan 01 2005
parent "Anthony Borla" <ajborla bigpond.com> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:cr6o46$bfu$1 digitaldaemon.com...

Greetings,

 "ed_davis2 at yahoo.com" <ed_davis2_member pathlink.com>
 wrote in message news:cqv0he$1f2e$1 digitaldaemon.com...
 Using the stand-alone version of dscript, how do you tell
when there is no more
 standard input, as in:

 ds foo.js <file.txt
There currently isn't a way. I should probably fix that!
I recently had a look at DMDScript 1.06 [standalone version] and noticed that this situation still exists. Would it be possible to remedy this for the next release ? For example, might it not be useful to return 'null' on EOF, thus allowing this sort of construct: var line = readln(); while (line != null) { ... line = readln(); } It would certainly enhance the utility of what appears to be quite a fine product. Cheers, Anthony Borla
Jul 21 2005