From: | Rolf Max Rotvel |
Date: | 19 Jan 2000 at 20:48:35 |
Subject: | Re: Re: File-Read |
From: "Rolf Max Rotvel" <rolfr@worldonline.dk>
Hi Lorens Johansson. On Wed, 19 Jan 2000 17:56:16 +0100 you wrote:
> > I have a Textfile witch always has the same format:
> > first line has a title, second line is empty and the third line to the end
> > of the file has text.
> >
> > how can I realize it to get a variable with the title (whithout the rest
> > of text) and a variable with the text (without the title and the empty
> > second line) of this file?
>
> View WITHOUT textstyles!!!
>
> /* Starts here! */
>
> OPTIONS RESULTS
>
> CALL OPEN("fil","RAM:test.fil","R")
>
> title=READLN("fil")
> CALL READLN("") /* to read the empty line without store it */
>
> i=0
>
> DO UNTIL EOF("fil")
> i=i+1
> text.i=READLN("fil")
> END
> CALL CLOSE("fil")
If the textfile is smaller then 64 kb there's a much faster
solution:
/**/
file = arg(1)
nl = '0a'x
if ~open('tmp', file, 'r') then exit 10
parse value readch('tmp', 65535) with title (nl) . (nl) text
call close('tmp')
exit
The 'title' variable now holds the the title line (Without
trailing nl) and the 'text' variable the rest of the text (Without
leading nl)
Regards
Rolf
--------------------------- ONElist Sponsor ----------------------------
Hey Freelancers: Find your next project through JobSwarm!
You can even make money in your sleep by referring friends.
<a href=" http://clickme.onelist.com/ad/jobswarm1 ">Click Here</a>
------------------------------------------------------------------------
ARexx mailing list - No flames, no overquoting, no crossposting. Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com