
-----------------------------------
mirhagk
Mon Feb 21, 2011 1:10 pm

sytem(&quot;pause&quot;) whats the big deal?
-----------------------------------
Yes there are alternatives, such as using conio.h _getch. But WHY???? conio.h is still platform specific, and DON'T TELL ME IT'S CUZ IT'S SLOW!!!!!!! IT'S A FREAKING PAUSE COMMAND, IT'S SUPPOSED TO STOP SO WHO CARES!!!!!!!!!!

I agree system("pause") shouldn't be used in a distrubuted exe simply because they may have defined their own PATH variable that overrides system.

But it's a great way to pause the program at the end to see the output while debugging, as it requires only one line of code. And it's a great way to introduce the programmer to system commands. As you can get them to use this, and then be like "BTW, type that into the command prompt" and then you can teach them that the system() command is basically an interface to command prompt, so you can do things from system that you could do from the command line.

Yes don't use it for final projects, but who cares for testing and learning purposes.

Sorry, I just hate reading things where people argue that system("pause") is too slow. Im like *blank stare*

-----------------------------------
DemonWasp
Mon Feb 21, 2011 3:29 pm

RE:sytem(&quot;pause&quot;) whats the big deal?
-----------------------------------
Consider: http://www.gidnetwork.com/b-43.html

Most of the arguments are that you shouldn't have to explicitly pause your program to let the user see output anyway -- it should just be sitting there in the terminal / terminal emulator in your IDE.

Another valuable argument is that it isn't cross-platform, it isn't widely used, and it requires that you load up more libraries at runtime.

If you use platform specific things, you are (generally) limiting yourself for little or no reason. You will eventually find that you want your code to run elsewhere (or, one of your customers will) and then you're up the proverbial creek. If you wrote it right in the first place, you wouldn't have any trouble at all.

Plus, if you write your code in a cross-platform manner, that means that anyone can contribute to your project. If your friend wants to work on code that has system("pause") sprinkled through it, they will first have to fix all those invocations before they can get any actual work done. Better to do things right the first time, as much as possible, to avoid bigger problems later.

-----------------------------------
bbi5291
Mon Feb 21, 2011 4:36 pm

Re: sytem(&quot;pause&quot;) whats the big deal?
-----------------------------------
And it's a great way to introduce the programmer to system commands. As you can get them to use this, and then be like "BTW, type that into the command prompt" and then you can teach them that the system() command is basically an interface to command prompt, so you can do things from system that you could do from the command line.I really don't think this is a valid argument, anyway. For example, could I not claim using the same logic that 'cout 