Hey, all. I'm trying to find a way of making a platform independent way of pausing the program pending a key-press, without requiring a carriage return. I found numerous posts and topics regarding this subject, but this one in particular worried me: http://cplusplus.com/forum/beginner/1574/#msg5512.
Since the problem is apparently platform dependent, is there a way of determining the user's operating system? I am guessing there is a macro somewhere that would work, but I haven't been able to find it. Here's my idea:
You can't detect the user's OS. Well, not at run time, anyway. You can use compiler-defined macros to compile different code based on the compiler's target platform. Pretty much what you're doing up there. http://predef.sourceforge.net/preos.html
As for your real question, provided that you consistently used nothing but std::getline() to get user input from the console, a simple