Re: sequences read from file

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

Felix,

To do what you want, you need to convert line from a string of characters into
the sequence the string represents. Then you need to be sure that whatever you're
printing is in the proper representation for printing.

For example (untested),

sequence line
line = value("{0, "howdy", {42}}) -- use the value function!
puts(1, sprint(line[1]) & "\n") -- "0"
puts(1, line[2] & "\n") -- the string "howdy"
puts(1, sprint(line[3]) & "\n") -- the sequence "{42}"

In a nutshell, learn about value and sprint and use them where appropriate.

Does that clarify things any?

George

--

On Thu, 01 Feb 2001 06:24:21  
 felix geiger wrote:
>hi everybody
>
>i have a file and in that file (referred to as fn_in) there is this:
>
>{{00,10,01},{"g",3,"text"},{"#",5,"text"}
>{"g",1500,"text3"},{"#",1600,"text4"}
>{"g",1500,"text5"},{"#",1600,"text6"}}
>{{00,10,02},{"g",3,"text"},{"#",5,"text"}
>{"g",1500,"text3"},{"#",1600,"text4"}
>{"g",1500,"text5"},{"#",1600,"text6"}}
>
>
>now i use
>
>    line = gets(fn_in)
>    if sequence(line) then
>        puts(fn_out, line[1][1])
>    end if
>        
>i thought this would write this into the output file (referred to as
>fn_out)
>
>00
>
>because i thought that line[1] is {00,10,01} and then line[1][1]
>should be 00.
>
>but it gives me an error (attempt of subscripting an atom).
>
>what do i do wrong?
>
>thanx in advance
>felix
>
>
>


Get your small business started at Lycos Small Business at
http://www.lycos.com/business/mail.html

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

Search



Quick Links

User menu

Not signed in.

Misc Menu