Mail Archives: djgpp/1999/08/29/07:57:43
Al Morgan wrote:
>
> I think what you want is... "kbhit()". It will return true when a key has
> been pressed, like this:
>
> #include <iostream.h>
> #include <conio.h> // kbhit is in there, i think it might be in
> stdlib.h too, not sure.
>
> void main()
> {
> int n = 0;
> while(!kbhit())
> {
> cout << n++ << endl;
> }
> }
>
> This program will count from 0 to infinity until the user presses a key.
>
> Is that what you were looking for?
> Al [muaddib AT proaxis DOT com]
Thank u, the _kbhit() function from conio.h works (there seems to be no
kbhit() function--needs the _ at beginning). This maybe because of the
compiler I am using: lcc-win32.
--
Robinson S.,
mailto:roby AT lords DOT com
- Raw text -