From: "Al Morgan" Newsgroups: comp.os.msdos.djgpp Subject: Re: Trap Keyboard Events Date: Tue, 24 Aug 1999 01:38:36 -0700 Organization: Posted via Supernews, http://www.supernews.com Lines: 36 Message-ID: References: <37C156BB DOT 4808 AT lords DOT com> X-Complaints-To: newsabuse AT supernews DOT com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I think what you want is... "kbhit()". It will return true when a key has been pressed, like this: #include #include // 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] Robinson S. wrote in message news:37C156BB DOT 4808 AT lords DOT com... > I've searched through some of the c faqs out there and could not find > the answer to this question: > > How do I check if a key has been pressed on the keyboard while my > program is running. It is a program that runs the win-ping command, so > it may apply to win32s as well. > > -- > > Robinson S., > mailto:roby AT lords DOT com