Is there any way to use standard C++ to wait for user input? And by input I don't mean just the enter key, I mean ANY key will continue executing code. I know about the conio.h and Windows.h libraries but those aren't standard C++ and I really want to get out of the habit of using them.

Recommended Answers

All 5 Replies

No I think you have to use the OS API.
Sorry.

There are libraries that try to provide this behavior across multiple platforms. PDcurses is one example.

I'm not that good with streams and such, but you could try using istream::get or getc if you are using cstdio .

No. They wait for the ENTER to be pressed

commented: My bad :( +4

My bad then :(
Sorry about that. A lib it is then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.