
-----------------------------------
Scooter341
Thu Apr 28, 2005 1:01 pm

system(&quot;pause&quot;) help
-----------------------------------
I'm using DevCpp and I am hoping to find out whether there is a way I can control what is diplayed when I use 


system ("pause");


I was hoping to change it from "Press Any Key To Continue..."

-----------------------------------
wtd
Thu Apr 28, 2005 1:09 pm


-----------------------------------
When you use this, you're simply calling a external program.  "pause" is a program on Windows which simply displays the "Press any key to continue..." message, then terminates.  

You can (and should, if you wish to move beyond Windows) simply write your own equivalent by printing a string to standard output and getting some input.

-----------------------------------
Martin
Thu Apr 28, 2005 1:24 pm


-----------------------------------
Yes. System calls are an easy way to write bad code. Use getch ()

-----------------------------------
wtd
Thu Apr 28, 2005 1:27 pm


-----------------------------------
I believe he's using C++, so using a C function would be inappropriate where C++ can easily fill the role.

char answer;
std::cin >> answer;

-----------------------------------
jamonathin
Thu Apr 28, 2005 1:28 pm


-----------------------------------
Is that the same concept as this?

int wait;
std::cin >> wait;


edit: bah neva mind  :P

-----------------------------------
md
Thu Apr 28, 2005 2:15 pm


-----------------------------------
If your sticking to windows you can always use the windows system call Sleep(), it takes the number of milliseconds to sleep for; although then you'll only be delaying for a set amount of time

-----------------------------------
Cinjection
Fri Jun 10, 2005 2:28 pm


-----------------------------------
DO NOT USE system("PAUSE"); !
It will hinder the portability of your program. Use 'cin.get()' to pause a program. If you use system("PAUSE"),that program will only work on a windows machine. With cin.get();  you increase its portability.

-----------------------------------
MysticVegeta
Sat Jun 11, 2005 8:37 am


-----------------------------------
oh lol i do it the cheap way ->
int foo;
cin >> foo;
return 0;


-----------------------------------
Cinjection
Sat Jun 11, 2005 8:47 am


-----------------------------------
oh lol i do it the cheap way ->
int foo;
cin >> foo;
return 0;


ummm, why? Just go:


cout foo;
return 0;


ummm, why? Just go:


cout