Re: Stopping C program after user input

From: David Schwartz (davids_at_webmaster.com)
Date: 10/13/05


Date: Thu, 13 Oct 2005 14:02:58 -0700


"ern" <erniedude@gmail.com> wrote in message
news:1129232937.125808.294680@g44g2000cwa.googlegroups.com...

>I have a program that runs scripts. If the user types "script
> myScript.dat" the program will grab commands from the text file, verify
> correctness, and begin executing the script UNTIL...
>
> I need a way to stop the execution with user input. I was thinking
> something like this:
>
> while(user hasn't pressed 'any key'){
> keepExecutingScript();
>
> }
>
> How can I do the "user hasn't pressed 'any key' " of this logic?
> Running Linux Red Hat V3. (The 'C' forum sent me here.)
>
> Thanks,

    Google for 'unix kbhit'. (The 'kbhit' function was the old DOS way to do
this and most people ask the question as "Where's 'kbhit' on unix?")

    DS



Relevant Pages