I tried std::getchar();
, cin::get();
and system ("sleep");
, but nothing stops the console from closing, because it seems, that all of these functions misinterpret the pressed enter key that was supposed to confirm input for scanf
. How can I prevent the console from closing with a "Press enter / any key to close" behavior after scanf? I don't want to use functions stopping the console totally from doing something for some time (like sleep) or non-portable functions (like system ("sleep")
), unless such functions are the only ways.
int main () {
wchar_t *user = new wchar_t[30];
wscanf (L"%30ls", user);
// Process data... (very short time)
std::getchar ();
return 0;
}
IDE: Visual Studio 2013 (12.0) Express I don't know the compiler. I created an empty C++ project and didn't change any settings.