Re: simple question

new topic     » goto parent     » topic index » view thread      » older message » newer message

Chris,

The buffer contains a sequence of text strings.  You can get a single text
string by using the &= operator instead of append:

buffer &= line

Another solution is to print out the buffer one line at a time:

for i = 1 to length buffer do
    printf(1,"%s",{buffer[i]})
end for

- Colin Taylor

----- Original Message -----
From: "Chris Saik" <csaik2002 at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, December 19, 2002 2:01 PM
Subject: simple question


>
>
> Please bear with me, as I'm a brand spankin' new user
> of Euphoria.
>
> All I'm trying to do is read a text file into a
> sequence, and then turn around and print the sequence
> onscreen.  I'm using the following code:
>
> sequence buffer
> object line
> integer fn
>
> fn = open("c:\\filename.txt","r")
> if fn = -1 then
> puts(1,"Couldn't open file\n")
> abort(1)
> end if
>
> while 1 do
> line = gets(fn)
> if atom(line) then
> exit
> end if
> buffer = append(buffer,line)
> end while
>
> printf(1,"%s",{buffer})
>
> When I try to run the above, I get the following error
> message:
>
> "sequence found inside character string"
>
> What am I doing wrong?
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu