Re: Text lines into an array of unknown size
*One* special character in the mail, and Topica mangled almost the
whole mail ... Grrrrr!
Here's the code again (the variable 'count' wasn't necessary anyway):
constant ERROR = 2
integer file
sequence tx
object line
file = open("c:/rexx/rxcalibur.txt", "r")
if file = -1 then
puts(ERROR, "couldn't open text file\n")
abort(1) -- end of program, exit code 1
end if
tx = {}
while 1 do
line = gets(file)
if atom(line) then
exit
end if
tx = append(tx, line)
end while
close(file)
printf(1, "available lines: %d\n\n", {length(tx)})
for i = 1 to length(tx) do
puts(1, tx[i])
end for
Best regards,
Juergen
--
/"\ ASCII ribbon campain |
\ / against HTML in | This message has been ROT-13 encrypted
X e-mail and news, | twice for higher security.
/ \ and unneeded MIME |
|
Not Categorized, Please Help
|
|