|
-
Mar 20th, 2002, 03:15 PM
#1
Thread Starter
Junior Member
Test for Key press
Im a complete newbie at C++
I have created an object using a constructor. When an object is created a message is displayed on screen. I want to be able to display this message on the screen until a user presses a key before the program returns to main.
In the main i have
void main()
{
object new_object("Display This");
object2 new_object2;
new_object2.afunction();
}
The constructor code is
object: bject(char adsupplied[])
{
while(??)
{
cout << text<<endl;
}
}
I know a need a while loop in the constructor but do not now how to detect if a key is pressed.
Any help would be appreciated
-
Mar 20th, 2002, 07:31 PM
#2
Lively Member
-=conio.h=-
kbhit() - check if a keystroke is avaliable
getch() - get the keypress
-=bios.h=-
bioskey(3) - Check if modifiers were pressed (Shift, Alt ....)
bioskey(1) - bios version of kbhit()
bioskey(0) - bios version of getch()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|