Re: Newbie Question

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

----- Original Message -----
From: <tpopel at yahoo.com>
> I have to do some work with 2 dimensional, comma
> delimited text files.
>
> Is this the kind of thing Euphoria does well?

Yes - you'll probably want the strtok.e include file from the RDS website ,
it makes parsing much easier.

> What replaces the old input# statement from basic?
gets(fn)    -- "gets" a string from fn where fn is the assigned file handle.
You might try something like:

include strtok.e
object data, line
atom fn

data = {}
line = ""
fn = open("myfile","r") -- may want to check fn = -1, means can't open file

while 1 do
   line = gets(fn)
     if atom(line) then exit -- EOF
     else
        line = parse(line,',') -- line in = "one,two,three", out =
{"one","two","three"}
       data = append(data,line) -- store it away for later use
     end if
end while

Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu