pause()

I am just looking for some feedback on this one. I am aware that I could use SYSTEM("pause"); to pause console output but that is obviously a Windows only option. If I want portability I would need to write my own function, correct? With that said, is the following code adequate or am I over looking something:

1
2
3
4
5
6
7
8
void pause()
{
	char crap;
	cout << endl << "Paused... press any key and hit enter to continue:\t";
	cin >> crap;
	cin.clear();

}


Also, is it possible to make it so the user doesn't have to press enter -- they just have to press any key??
http://www.cplusplus.com/forum/beginner/1988/

Please don't start another discussion on this, we already have one stickied.
You may read through those seven pages to find the answer that most suits you, however solutions posted by Duaos (Spelling?) are usually the best IMO.
Topic archived. No new replies allowed.