PDA

Click to See Complete Forum and Search --> : system("PAUSE")


Poop782
September 17th, 2004, 06:56 AM
I am writing a C++ program. I am using the function "system("PAUSE"); ". I was wondering how I could make it do the same thing just not the the
words " Press any key to continue....".

Winston
September 17th, 2004, 07:02 AM
I don't know if that's possible, but try this:

Set the program into a loop, until whatever condition is met. (ie while x do y, if z do whatever.)
This way, you will have full control over both the message (if any) and the action to resume the program.

lepricaun
September 17th, 2004, 07:25 AM
why use the system("PAUSE"); command, if the only thing you want is wait for a keystroke, then do it like this:



#include <stdio.h>

int main(void)
{
char c;
c=getch();

return 0;
}


the getch() function works only on windows (with the standard libraries at least) and otherwise you could use the getchar() function.
this way the system is waiting for a keystroke before the program continues...

gothic_type
September 17th, 2004, 02:40 PM
you also need the conio.h header file included in order to use getch()

ac

lepricaun
September 17th, 2004, 07:52 PM
yes, thats right (if your programming for linux). otherwise you could use the getchar() function for it...