[vox-tech] a better scanf?? (C-programming question)
Andy Campbell
vox-tech@lists.lugod.org
Fri, 18 Apr 2003 15:26:54 -0700
>
> I'm trying to read your intent from the code above,
> and it seems to be "run a process until
> it finishes or let me press 'x' if I run out of patience." If
> that's the case,
> then it'll be much easier to interrupt the process with <ctl>c instead.
really the intent of this program is "let me see if I can get the string
'Waiting...' to print over and over again until I input any letter (other
than x) at which point waiting will then print over and over again....
>
> Another possibility of intent is to prompt the user with a list
> of choices,
> assigning each choice a single letter to press, and have that choice be
> recorded without having to press <enter>. If that's the case, then Ryan's
> reference to the function "set_keypress()" will work. However,
> the function
> as posted has some bugs in it. Here is a complete program with the
> function working.
It's not just pressing enter....I actually implemented the set_keypress
function successfully (not shown in the code obviuosly) but it is not what I
want. It still stopped the program flow until I entered one character, at
which point it continued through once and got hung up on the getchar()
function again.
I want it to run through the code continuosly, and then when I input a char,
it interrupts the program and stores the value.