Re: Reading a file into a "sequence"...correction

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

John F Dutcher wrote:
> Alexander Toresson wrote:
> > John F Dutcher wrote:
> > > 
> > > Sorry about the question over the line[1..4] = "%HDR" issue....
> > > it needed to say line[2..5] of course.....
> > > That just leaves being able to treat the values in line as
> > > members of a "sequence".......
> > >
> > Here's a solution (assuming that the lines were split by the forum):
> > 
> > items = value("{" & gets(fn) & "}")
> > items = items[2]
> > 
> > ...would read a line, add braces around it, and then give it to value(),
> > which reads a string representation of a euphoria object.
> > It will then get the second element of the returned sequence,
> > which is the euphoria sequence (the first element is error status).
> > Your lines will be valid representation of euphoria sequences if you just
> > put braces around each of them.
> > 
> This err message results from the code lines below when using "value",
> I am probably messing up the exercise....
> 
> "C:\EuphoriaMyScripts\ThirdMill2.exw:83
> sequence found inside character string "
> 
> object line
> while 1 do 
>       line = value("{" & gets(fn) & "}")
>       line = line[2]
>       puts(1, line & "\n") <-------- error line highlited
> end while

line is now probably a sequence of strings...

{"One","Two","Three"}

Try using

    for t=1 to length(line) do
        puts(1,line[t] & "\n")
    end for

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu