Original Post
I'm a beginner C++ programmer and I am having a problem with some simple code. I use MSVC++ 6.0 Intro Ed. I am trying to create a simple routine function that will pause a DOS program and wait for a keypress. The code is at the bottom. When I run the program, the first pause will work. But when I press a key, it skips the rest of the "pauses". Please tell me what I'm doing wrong or what I can do to perform this task.
--------------Source---------------
#include "rc_pause.h"
#include stdio.h //there are brackets around these (gamedev thinks its a html tag)
#include conio.h
main()
{
printf("Welcome to a pause demo\n");
pause();
printf("you pressed a key\n");
pause();
printf("you pressed another\npress again to exit\n");
pause();
return 0;
}
-------"rc_pause.h" Source---------
#ifndef pause
#define pause
#include conio.h
//Pause function
int pause();
int pause()
{
int wait_for_key=0;
while(wait_for_key==0)
{
wait_for_key=kbhit();
}
}
#endif
Any tips would be greatly appreciated!
RyanC
---------------------------
Games are only as good as you make them...
Edited by - ryanc on 10/15/00 9:51:35 PM