Q: keyboard interrupt of loop? 
Author Message
 Q: keyboard interrupt of loop?

help.

what i would like to do is loop through exectution of a few
commands indefintely until a key is pressed (preferably ANY
key, not just ctrl-break).  any pointers or where i should look
to read up on this would be appreciated!

thanks,
bruce

--

"If 'pro' is the opposite of 'con', what is the opposite of progress?"



Sat, 24 May 1997 05:37:32 GMT  
 Q: keyboard interrupt of loop?

Quote:
> what i would like to do is loop through exectution of a few
> commands indefintely until a key is pressed (preferably ANY

    What sort of commands? System commands, like in a batch file? Or
    do you mean functions that are part of your program?

    If you mean functions in your own program, then how you detect
    whether or not a key has been hit depends on what system you're
    using. I presume that because you mentioned Ctrl-Break you are yet
    another MS-DOS user, in which case your compiler may support a
    function called kbhit() that can be used to detect whether or not
    a key has been pressed, and maybe also one called getch().

Quote:
> bruce

--

***             Count Templar, ELITE, Cobra Mk III (FM-287)             ***


Sat, 24 May 1997 18:58:44 GMT  
 Q: keyboard interrupt of loop?
: > what i would like to do is loop through exectution of a few
: > commands indefintely until a key is pressed (preferably ANY

:     What sort of commands? System commands, like in a batch file? Or
:     do you mean functions that are part of your program?

:     If you mean functions in your own program, then how you detect
:     whether or not a key has been hit depends on what system you're
:     using. I presume that because you mentioned Ctrl-Break you are yet
:     another MS-DOS user, in which case your compiler may support a
:     function called kbhit() that can be used to detect whether or not
:     a key has been pressed, and maybe also one called getch().

Actually, I was looking at this, except that I was trying to do it on
a UNIX platform (Solaris 2.3.. maybe 2.4 depending on whether or not the
sysadmin installs 2.4 or not this christmas).  
        Some of the things I have tried to do (to no avail) was to set
stdin to be a non-blocking file stream, via fcntl(), and using iocntl()
(and the whole family of functions that both of them involve).  I guess
I didn't use them right or something, but niether worked.  If I still had
the sources I would post them for comments (but they're gone).

        Any suggestions?

Thanks,
Bill



Sat, 31 May 1997 11:01:06 GMT  
 Q: keyboard interrupt of loop?

Quote:
> Actually, I was looking at this, except that I was trying to do it on
> a UNIX platform (Solaris 2.3.. maybe 2.4 depending on whether or not the

    I think you may get a better answer in a Solaris newsgroup, if
    there is such a thing. Even from one version of UNIX to the next
    this kind of operation varies.

Quote:
>    Any suggestions?

    One suggestion would be to get the source code for a program that
    does something similar on your system, and copy it. I have found
    the source code to the programs Less and MicroEMACS helpful in
    UNIX work I've done.

Quote:
> Bill

--

***             Count Templar, ELITE, Cobra Mk III (FM-287)             ***


Sat, 31 May 1997 20:30:22 GMT  
 Q: keyboard interrupt of loop?

[In response to stuff about detecting key presses, but under Unix]

Quote:
>    Some of the things I have tried to do (to no avail) was to set
>stdin to be a non-blocking file stream, via fcntl(), and using iocntl()
>(and the whole family of functions that both of them involve).  I guess
>I didn't use them right or something, but niether worked.  If I still had
>the sources I would post them for comments (but they're gone).
>    Any suggestions?

Two:

(1) buy any decent book on Unix programming and learn the basics
    of this trivial operation;

(2) if you still have trouble with it, take your questions to an
    appropriate place such as comp.unix.{questions,programmer}.

--



Sun, 01 Jun 1997 05:03:56 GMT  
 Q: keyboard interrupt of loop?

Quote:

>[In response to stuff about detecting key presses, but under Unix]

>>        Some of the things I have tried to do (to no avail) was to set
>>stdin to be a non-blocking file stream, via fcntl(), and using iocntl()
>>(and the whole family of functions that both of them involve).  I guess
>>I didn't use them right or something, but niether worked.  If I still had
>>the sources I would post them for comments (but they're gone).
>>        Any suggestions?

>Two:

>(1) buy any decent book on Unix programming and learn the basics
>    of this trivial operation;

>(2) if you still have trouble with it, take your questions to an
>    appropriate place such as comp.unix.{questions,programmer}.

 (3) before asking there, read their FAQ.  It might help.

 (4) learn how to use the online documentation (man pages, at least).
     This is the fastest way to get the right answer.

Dan
--
Dan Pop                       | The only reason God was able to make the
CERN, CN Division             | world in 7 days was he didn't have to remain

Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



Mon, 02 Jun 1997 02:52:44 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Keyboard interrupt inside a loop

2. Hooking/redirecting keyboard interrupt in C(++)

3. interrupt a loop with keypress

4. Keyboard interrupt

5. Keyboard interrupt ?

6. Help : timer, interrupt & keyboard

7. Keyboard interrupts on the PC

8. How to interrupt a server while exeuting a function in while loop

9. Bimodal keyboard interrupt 9 trouble

10. Keyboard Interrupt Enable

11. Q: keyboard interrupt of

12. Keyboard interrupts in TC

 

 
Powered by phpBB® Forum Software