0

what's system pause

in code tutorial I'm watching int main(){ system("pause>0"); } this block appears. what this actually does I didn't get. can someone explain it? Is it something like return0 or return1 ?? and what about it being greater than zero ??

17th Dec 2022, 1:38 PM
Lalala
Lalala - avatar
4 odpowiedzi
+ 3
According to this article https://medium.com/@ashutoshporwal_44235/is-system-pause-correct-way-to-pause-program-602100e5639e It is a way to halt the console from closing immediately by waiting for a key press, and to avoid the display of "press any key ..." message. It also mentioned that the command is platform dependent.
17th Dec 2022, 2:02 PM
Ipang
+ 3
Honestly I don't know Lalala The "press any key..." message is displayed by the call to 'pause' command. The article only mentioned that "pause>0" argument will make the key press awaiting take place without message display, maybe like a blinking cursor only, no message at all. I can't tell you about '=0' or '<0' You need to test it out yourself I guess, I'm on mobile (Android), can't try it, perhaps it was Windows specific feature : )
18th Dec 2022, 2:17 AM
Ipang
+ 1
Ipang so is there any other way to delete that " press to continue" thing or is it just system pause ? And what if I say =0 or <0
17th Dec 2022, 9:28 PM
Lalala
Lalala - avatar
+ 1
Ipang I'm on Android as well. You could try the app Cxxdroid, it sometimes works for me with code that doesn't run properly on Sololearn (also allows using different libraries etc.) so makes as a good companion. If you run the code in the app the console opens, pauses and gives no message. Then if you press any key the message [program finished] appears.
18th Dec 2022, 10:30 AM
Scott D
Scott D - avatar