Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to prevent console exe from ending

Status
Not open for further replies.

innmedia

Programmer
Mar 24, 2000
108
US
Hi All,

I have a simple console app which performs a couple of calculations and prints them to the window. While in development (VC++6) it works great - a message appears - press any key to end (or something like that)

When I use the actual exe by itself the program opens and ends in a flash. What code do I need to keep the window open like when in dev mode?

Thanks,

KB
 
You should put the app to wait for something. The simplest solution in this case is to use one function that requires an input from keyboard, for example:


#include <conio.h>
int x;
cout<<&quot; Hit a key to terminate the application..&quot;
x = getch();

-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top