0
How to hold output on the screen in C++ ?
5 Respostas
+ 5
As Martin Taylor has pointed out, getch() is a poor option. If your IDE really does not halt for you, use getchar(), which is the standard alternative.
+ 2
okay thank you guys
+ 2
Martin Taylor I was being flippant. It was a joke. Creating the most elaborate method possible, hence the system() calls instead of getchar(), along with the preprocessor.
I fully agree about not polluting code for the tools you're using. I should probably remove that post. I have these moods I get into. I've been making lots of these posts lately. I honestly didn't think _that_ would be taken seriously.
*PS: For those interested, POSIX read seems to need a parameter.
0
using getch() function
0
Why not use system() and call an OS command like "read" (*nix)?
(I think it was "pause" on MS-DOS/Windows, my memory's hazy as usual?)
Then use a preprocessor command to exclude it from the final build?
#if DEBUG_MODE
system("read");
#endif
*read works without parameters in GNU, I dunno if this is POSIX.