0

How to hold output on the screen in C++ ?

28th Apr 2018, 5:21 PM
Lovenish Purohit
Lovenish Purohit - avatar
7 ответов
+ 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.
29th Apr 2018, 2:46 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
okay thank you guys
29th Apr 2018, 4:28 AM
Lovenish Purohit
Lovenish Purohit - avatar
+ 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.
29th Apr 2018, 10:20 PM
non
0
using getch() function
28th Apr 2018, 6:48 PM
harinder singh
harinder singh - avatar
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.
29th Apr 2018, 5:58 PM
non