Re: simple question

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

Thank you Mike!  That worked perfectly.  I'll get a
grip on the language sooner or later... =)


--- Sabal.Mike at notations.com wrote:
> 
> There are actually 2 problems here.  First, buffer
> is never initialized.
>  You should have a line near the beginning that
> reads buffer = "" or
> buffer = {}.  As for the second problem that you
> stated, the solution
> depends on whether you want one long string or a
> sequence of strings. 
> If you want one long string, you should be using
> buffer = buffer & line.
>  If you want a sequence of strings, you should have
> a loop to print
> them:
> 
> for ctr = 1 to length(buffer) do
>   printf(1,"%s\n",{buffer[ctr]})
> end for
> 
> HTH,
> Mike Sabal
> 
> >>> csaik2002 at yahoo.com 12/19/02 02:01PM >>>
> 
> 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