Running 5.02 on XP

Running 5.02 on XP

Post by Matt » Thu, 25 Dec 2003 13:40:50



I'm a newbie to this programming thing in general, so that's probably why I'm having a problem with such a simple thing. When I compile a program and run it, the program only runs for a split second. I know the program runs fine, I just need to know how to change some settings so the window doesn't close automatically when the program has finished. Help would be much appreciated.
 
 
 

Running 5.02 on XP

Post by Matt » Thu, 25 Dec 2003 14:28:53

Great, thanks for your help!

 
 
 

Running 5.02 on XP

Post by Ed Mulroy » Thu, 25 Dec 2003 15:09:07

When you start a text mode program from within a Windows graphical
environment, Windows opens the console window that will show the program's
output because the program requires it. When the program is finished that
window is no longer required so the console window is closed.

If you want to wait at the end to see all of what the program did you can do
one of two things, place a breakpoint on the return statement in main or if
you place getchar(); on the line immediately before the return in main it
will wait for the Enter key to be pressed.

. Ed
 
 
 

Running 5.02 on XP

Post by Craig Cren » Sun, 01 Feb 2004 04:07:06

Hi,

I've ben having the same problem.

2 Questions;

1- what process did u go through to create the .exe in the first place &

2- can u describe agian please how to add the getchar(); to the program in
the following simple example;

-----------------
#include <iostream.h>

main()
{
cout << " Hello World!\n " ;

}
----------------------------------

Thanks,
Craig.





I'm having a problem with such a simple thing. When I compile a program and
run it, the program only runs for a split second. I know the program runs
fine, I just need to know how to change some settings so the window doesn't
close automatically when the program has finished. Help would be much
appreciated.
 
 
 

Running 5.02 on XP

Post by Craig Cren » Sun, 01 Feb 2004 04:19:59

Thant's ok I just got it!

Thanks for the help.

C





why
and
doesn't