open and read commands
Laura Brody
laura at hvcomputer.com
Sat Dec 1 18:36:46 PST 2007
Quoting Mike Fedkiw <filepro at adelphia.net>:
> This helped. I can now read the first line from the text document.
>
> How do I get it to continue though the rest of the .txt document? It is only
> reading the first line.
Because that is what you told it to do. You need to
put the readline() in a loop (see below).
> (txt) returns the text I am looking for and (x) seemed to be the length of
> (txt)
That is what it is supposed to do.
> ----- Original Message -----
> From: "Laura Brody" <laura at hvcomputer.com>
> To: <filepro-list at lists.celestial.com>
> Sent: Saturday, December 01, 2007 7:59 PM
> Subject: Re: open and read commands
>
>
>>
>>
>> You really want this:
>>
>> declare local handle(8,.0)
>> declare local txt
>>
>> aa="c:/jpgfile.wri"
>> handle = open(aa,"rt") 'notice that it is "rt" and not just r
>> if handle le "0"
>> then errorbox "Unable to open file:" < aa; exit
>> i = "160" 'how many characters will there be in a line and double it
rd_loop:
>> x = readline(handle,txt,i)
>> if x eq "o" 'EOF reached
then goto done
>> 'otherwise, do whatever you want with the text in variable txt
goto rd_loop 'go get yourself another line of text
done:
x = close(handle)
end
>> --
>> Laura Brody
>> +------------- Hudson Valley Computer Associates, Inc ----------+
>> | PO Box 859 120 Sixth Street http://www.hvcomputer.com |
>> | Verplanck, NY 10596-0859 Voice mail: (914) 739-5004 |
>> +------ PC repair locally, filePro programming globally --------+
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
>
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
--
Laura Brody
+------------- Hudson Valley Computer Associates, Inc ----------+
| PO Box 859 120 Sixth Street http://www.hvcomputer.com |
| Verplanck, NY 10596-0859 Voice mail: (914) 739-5004 |
+------ PC repair locally, filePro programming globally --------+
More information about the Filepro-list
mailing list