1. The Mother of All Euphoria Questions (Apologies in Advance)

Hello,

I think this question may have been asked before...   ;)

I simply want to display a large text file on the screen. I read in the text
file line by line as in the library gets example.  I am unable to simply
puts, printf etc the large sequence onto the display.

I can get it to work using a loop but I did not think that would be
necessary.

Stuart

new topic     » topic index » view message » categorize

2. Re: The Mother of All Euphoria Questions (Apologies in Advance)

----- Original Message -----
From: Stuart Brady <stu.doofer at CARE4FREE.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, January 23, 2000 8:26 AM
Subject: The Mother of All Euphoria Questions (Apologies in Advance)


> Hello,
>
> I think this question may have been asked before...   ;)
>
> I simply want to display a large text file on the screen. I read in the
text
> file line by line as in the library gets example.  I am unable to simply
> puts, printf etc the large sequence onto the display.
>
> I can get it to work using a loop but I did not think that would be
> necessary.

Try this:

sequence s
object line
integer fn
fn = open("text.txt","r")
s = {}

while 1 do
  line = gets(fn)
   if atom(line) then exit
   else s &= line
   end if
  end while
close(fn)

puts(1,s)


Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

3. Re: The Mother of All Euphoria Questions (Apologies in Advance)

> > I simply want to display a large text file on the screen. I read in the
> text
> > file line by line as in the library gets example.  I am unable to simply
> > puts, printf etc the large sequence onto the display.

> Try this:
>
> sequence s
> object line
> integer fn
> fn = open("text.txt","r")
> s = {}
>
> while 1 do
>   line = gets(fn)
>    if atom(line) then exit
>    else s &= line
>    end if
>   end while
> close(fn)
>
> puts(1,s)

Yes I see what my problem was.  I was using append and believed the library
descriptions of puts and
printf actually printing sequences. :-p

The sequences have to be  'simple'. i.e. not contain 'other sequences'.

{1,2,3,4,5}        O.K.
{1,2,3{4,5}}      *error*

The use of concatenation is a bit understated in the documentation.

Stuart

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu