about system(“PAUSE”)

about system(“PAUSE”)

Usually peopole will use the system(“PAUSE”) to pause a application when they develop a consol mode application. So do I.
In this document, we will discuss what the system(“PAUSE”) do.

 


1.    What is the system(“PAUSE”)?
Actually the PAUSE is an application in your OS.
You can try to enter the “pause.exe” in your command prompt.
So you will start up two applications if you write down the system(“PAUSE”) in you source.

image_thumb8

 

 

2.    What’s problem?
The “pause.exe” is an application which in your windows operation system.
Maybe sometime your application will be started up in the windows operation system.
Or some version of windows doesn’t offer the “pause.exe”.
Or someone remove the “pause.exe” in your OS.
These reasons will make your application to be wrong.

 

 

3.    How can I do?
You can use other source code as below to replace the system(“PAUSE”).

	char cPause;
do
{   
    cPause = ::getchar();
    if(cPause == EOF)         
        break;
} while(cPause != '\n');

Although it is not as simple as the system(“PAUSE”).
But I think it’s a safer solution than the system(“PAUSE”).