View Single Post
Old 08-27-2008, 03:24 PM   #5 (permalink)
george_1988
 
Newb Techie

Join Date: Aug 2008

Posts: 16

george_1988 is on a distinguished road

Default Re: C++ Programming Help

Try this and see if it's to your liking. You should be able to convert to C++ very easily.

Code:
	char ch;

	puts("Press any key... ");
  	scanf("%c", &ch);
	
	if(ch == 'A' || ch == 'a')
		// beep code goes here
	else
 		// whatever code goes here
One thing you should note is that this will be calling a scanf function, I believe the equivalent is the C IN (not sure of the code) function in C++.

As far as I am aware, to constantly "monitor" the keystrokes would require some sort of input stream to be created. There are no standard C/C++ library functions to do this. There may very well be ways to do this by invoking the Win32 API, but that's a topic I have no knowledge on.

Hope this helped in some way.
george_1988 is offline