Try this
for standard file access it is easier to use 'read instead of using 'open
and 'close
lines: read/lines %test.txt
foreach line lines [
; do what ever
]
;-- or you can access lines individualy by
lines: read/lines %test.txt
print lines/1
print lines/2
etc
Cheers
Allen K
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 21, 2000 1:52 PM
Subject: [REBOL] [REBOL] Reading text a line at a time
> I would like to read a text file a line at
> a time. What's more, I would like to read each
> line into a variable.
> After looking at the draft manual and reading
> fillines.html, I attempted the following code:
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> file: open/read %test.txt
> foreach line file [print line]
> ;like to replace the above line of code
> ;with one that reads into a variable
> ;perhaps for parsing or modification
> ;and then prints it
> close text
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> {The second line of code generates an error message}
>
> I'd like to make a comment here:
> I learned C starting about 9 years ago, with
> my main reference called (if I remember correctly),
> "The C Users Bible". It had a very special rule.
> EVERY EXAMPLE WAS FULLY EXECUTABLE!! Nothing taken
> out of context.
>
> I believe if Rebol makes this a goal, for a manual,
> you can kick some Perl butt out there in Cyber Land.
> These first tiny steps for any newbie are as important
> as showing off the power of Rebol.
>
> Now you have it in writing: If I can help to this end,
> just ask.
> Thanks
> Tim
>
>