A basic c++ question.
In a console aplication, how do i wait for any key to be pressed?
like:
Code:cout<<"press any key to continue"<<endl; ???what should i put here???
A basic c++ question.
In a console aplication, how do i wait for any key to be pressed?
like:
Code:cout<<"press any key to continue"<<endl; ???what should i put here???
well you could include <conio.h> i think, then use the function getch();
or you could say "press enter to continue" and use cin.get();
working perfectly.
thanks
or you could use
system("pause");
instead of the cout<<"press any key to continue"<<endl;
???what should i put here???
it would save a lot of time if you use it a lot but some people say that its a curse if you use it, i really dont see why its so bad.
Keyboard Not Found! Press any key to continue. . .
1)pause is a program which is part of Microsoft windows and MS-DOS, compile you're program in another environment and it will fail, cin.get() is portable.Originally Posted by DeepFyre
2)The system command is slow because it's calling an external program.
3)It's insecure because somone could tamper with the pause command (or create a command with the same name in the local directory, depending on what the search order is)and that program would run with the privilages of your program.