Re: get() gets() etc...

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

>1. Someone writes a really clear tutorial on using input.

This would be helpful.

>2. Someone writes a small .e file to handle this task more
>   smoothly.

David Cuny has one on the Recent Contributions page. With commas.e (mine,
yeah, a shameless plug... :), you can do something like this:

number = remove_commas(gets(0))

To get a number. If you used get(), you'd need to do this:

junk = get(0)
if junk[1] = GET_SUCCESS then
    number = junk[2]
else
    number = 0
end if

Also, if the user just pressed ENTER, without typing anything, get()
would go to the next line and keep waiting until you type something other
than whitespace. My method assumes 0. (Like BASIC's INPUT) It also
allows:

$3,000
or
50%

Then again, it also allows:

4,4,4
(444)

and

44$45%%%443
(4445443)

Oh well....

(PS, if you coupled David Cuny's with mine, you'd have a SLE like in
TextGUI that can have default values like $5.00 or $5,000.00 [That's what
I did in one program that used TextGUI (using the TextGUI input stuff
[SLE]), and I think the effect is neat..])

Any better ideas? (Like a function to handle all of this, maybe something
that accepts a % code (%d, %f, etc) to determine the return value. (%c
would be single character [ie wait_key()])

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

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

Search



Quick Links

User menu

Not signed in.

Misc Menu