Re: sequences read from file

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

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"}
>    line =3D gets(fn_in)
>    if sequence(line) then
>        puts(fn_out, line[1][1])
>    end if

Besides the lack of commas on split-line sequences,
eg.
{{},{},{}, -- see the comma at the end?  This says the line continues.
{},{}}

your real problem is the line that says
line =3D gets(fn_in).

This is where the difference between get, gets, and getc can get a little =
confusing (pardon the pun). =20

Use get when you want to retrieve a list of numbers or sequences.
Use gets when you want to retrieve a string.
Use getc when you need a single character or byte.

If you change that line to
line =3D get(fn_in)
and remember to put commas at the end of sequences that continue
to the next line, your problem should be fixed.

HTH,
Michael J. Sabal

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

Search



Quick Links

User menu

Not signed in.

Misc Menu