www.digitalmars.com         C & C++   DMDScript  

c++.idde - system("PAUSE")

reply "Steve & Denise De Chellis" <dbouton snet.net> writes:
When I add the system("PAUSE") function to my programs it does not compile
properly.

ex:

main()
{
cout << "this is line 1\n";
system("PAUSE");
cout << "this is line 2\n";
return 0;
}

displays

press any key to continue

<any key>

this is line 1
this is line 2

I happen to be programming some dos apps and this is a BIG problem for me...

PS: the same code builds correctly with DJGPP

thanks
dungeonmaster snet.net
Dec 22 2001
parent "Walter" <walter digitalmars.com> writes:
Try cout.flush() after the output statement.

"Steve & Denise De Chellis" <dbouton snet.net> wrote in message
news:a031bi$m02$1 digitaldaemon.com...
 When I add the system("PAUSE") function to my programs it does not compile
 properly.

 ex:

 main()
 {
 cout << "this is line 1\n";
 system("PAUSE");
 cout << "this is line 2\n";
 return 0;
 }

 displays

 press any key to continue

 <any key>

 this is line 1
 this is line 2

 I happen to be programming some dos apps and this is a BIG problem for
me...
 PS: the same code builds correctly with DJGPP

 thanks
 dungeonmaster snet.net
Dec 22 2001