ARexx (3/77)

From:Neil Bothwick
Date:2 Apr 2001 at 09:29:25
Subject:Re: One too much...

Andreas Mixich said,

> Me wrote in a Mail about "[arexx] Re: One too much...":

>> call open('f3',"ram:f3",'w')
>> if open('f',"ram:f",'r') then DO b = 1 until EOF('f')
>> if line.b ~= "" then line.b = ReadLN('f')
>> num = WriteLN('f3','<LI><A HREF="'||line.b||'">'||line.b||'<A><LI>')
>> say line.b
>> END

or

call open(file,...)
while not eof(file)
x = readln(file)
if x = '' then iterate
/* do stuff*/
end

> Yes, thank you, that should work. What I do not understand is that there is
> no 'real' solution. I mean, something, where the llanguage itself takes care
> of such a thing. Cause, actually this is more a limitation.

The problem is that the eof is returned when you attempt to read beyond
the end of the file, when the empty line is returned, not when you read
the last character of the file. So this is a limitation of the language.

Another solution is

call open(file,...)
x = readln(file)
while not eof(file)
/* do stuff */
x = readln(file)
end

so the eof test is made immediately after the read. This one works with
files where blank lines matter, the previous two don't. Or you could use
the rmh function to read a file into a stem.

Neil



Neil Bothwick - New Media Editor, Amiga Active Magazine
Connected via Wirenet - http://www.wire.net.uk
The UK's first Amiga-only internet access provider
---
Windows Error #05: Nonexisent error. This cannot really be happening

------------------------ Yahoo! Groups Sponsor ---------------------~-~>
Find software faster. Search more than 20,000
software solutions on KnowledgeStorm. Register
now and get started.
http://us.click.yahoo.com/PabFaA/INSCAA/Jh4EAA/stAVlB/TM
---------------------------------------------------------------------_->

ARexx mailing list - No flames, no overquoting, no crossposting.
Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/