Re: Getting atom values with gets()

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

EU>  Sorry for the slew of questions lately.. I'm working on a big project.
EU>Details will be out in a week or so once more work on it is complete.
EU>  My question is about the gets() or get() commands.  I need to be able to
EU>input data as an atom...ie if I type 100 gets() will return 100, not
EU>{XX,YY,YY,10}.  Or I need to take the latter and convert it to 100.  This is
EU>probably as easy as tying my shoes, but I'm stumped.  I'll probably kick
EU>myself when I see how easy it is ; )

EU>Thanks,
EU>Derek Brown

Use get. Example:

include get.e
sequence s
puts(1,"Enter a number: ")
s = get(0)
if s[1] != GET_SUCCESS then
        puts(1,"You were supposed to enter a number!\n")
elsif not atom(s[2]) then
        puts(1,"A number. Not a sequence.\n")
else
        printf(1,"\nThe number you entered was %f\n",s[2])
end if

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu