RE: DOS: A newbie question about get()
Hi Brian, and others:
-----Original Message-----
From: Brian Broker [mailto:bkb at cnw.com]
What do you want to accomplish?
Fair point, Brian!
I realize now that I was trying to understand what get() does, how it
works, and where it stands in comparison with the other routines
available for reading input. So I set myself an artificial problem: if
my program had to read input that may be either a number or a string,
but that must not be a no_input or invalid_input, how would I implement
it using get(); and would get() be the best way of implementing it in
any case? (Maybe the problem would've been more convincing if I'd set
out to read data from a file.)
I realized that prompt_string() and prompt_number() will read their
respective data types, and that gets() won't read numbers; and I
understood that getc() will read the next character (altho' come to
think of it, I don't really understand in what context this might be a
useful thing to do). It seemed that get() was the ideal tool to read
either data type, and do a bit of error-checking at the same time. I
tried to write some code to put it thro' its paces, so to speak.
Maybe I should've asked: when's it best to use get()?
...or: in what programming tasks would get() be ideal?
...or even: if get() didn't exist, would it be missed?
Thank you for your advice
Alex Caracatsanis
|
Not Categorized, Please Help
|
|