User forums > Help

the program closes too fast...

(1/2) > >>

Zeus:
ok so i wrote a prog...where it asks u something and you type it in...in the console runner the program works fine and lets me type in my thing and then shows the result before it asks me to close it...when i try to run the .exe file from the project folder..I type in my number then I see the response flash very quickly and the program just closes before i can even read it..I tried putting "return 0;" at the end of my prog but still nothing..the only thing I have gotten to work is "system("PAUSE") " but I dont want to use that...someone help please

AkiraDev:
Windows explorer automatically closes command prompt programs as soon as they return an error code to the system (that's what your return 0; line is meant for) - this is normal behaviour. If you want your command prompt window to remain open, you should open the command prompt first (Accessories menu), and then run the program in there, a la MS-DOS.

Zeus:
is there another way...i dont feel like running the prog through the command prompt every time...

rickg22:
I think there was an option for shortcuts to keep the window opened after program exit... this way you can make a shortcut (in the desktop) to your program, and then just double click to run it. Ta-da :)

Zeus:
What if i wanted to give this prog to a friend...if he tryed to open it he would type something and it flash and would look dumb...im sure he wouldnt want to go through all that "ok open a command prompt and type this in..." instead of just double clicking the .exe....

Navigation

[0] Message Index

[#] Next page

Go to full version