Batch files!

Hi, everytime i make a console application i have to create a batch file to execute the application to make it stay open instead of instantly opening and closing, is there any way i can make it stay open without making a batch file?
try using

 
    system("pause");
Try cin.get();, if still closes with 1 , then type it twice ^^

Another option would be a never-ending loop

Hope it helped
woo thanks, the "system("pause")" worked, could you just quickly tell me how exactly it worked.

I mean, obviously its making the system pause before terminating, but how does it know i want to pause seeing as its a string value i used (seeing as quote marks are used)

Also, are there many other commands like that i could use.
NEVER suggest that someone use system("anything"), as it is bad form, a gaping security hole, slow, platform dependent, and some anti-virus programs recognize that it's a security hole.

Here's why system() is generally a bad idea: http://www.cplusplus.com/forum/articles/11153/

You might not have known, shredded, but now that you do... :)

@TpOreilly
The system() function basically calls the system's command processor, and so it happens that at least Windows has a command named pause. There are more details as to what system() does in the link I gave above.

-Albatross
Last edited on
You might not have known, shredded, but now that you do... :)


Yeah I didn't, id normally use a message and getch() but had seen system() used
in code on the message board and thought it was a better method.

Now I know better
Shredded

Topic archived. No new replies allowed.