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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

console closes immediately

Status
Not open for further replies.

greyhat

IS-IT--Management
Feb 7, 2004
3
CH
Hello everybody

Since I use vs.net2k3 my console applications close immediately.
When I used vs6 I always had the possibility to hit a key before the console closed. The message "press any key to continue" appeared.
So my question is, how can i get this feature again?

Thanks for suggestions, regards
 
If your execution is not paused by a loop then use cin.ignore(); to obtain the "press any key to continue" prompt.

-Bones
 
add a cin.get() just before the return statement in main(). Alternatively system("PAUSE") should do the trick.
 
Thanks for advices. I use a new line "getchar();" before the return value and it works fine.
But I would like it old school like in vs6, is that possible?
 
#include<conio.h> and getch()

Ion Filipski
1c.bmp
 
Thanks IonFilipski

That's a nice solution, it works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top