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

running a program out of a editor

Status
Not open for further replies.

mjb5038

Programmer
Feb 1, 2005
2
US
i was trying to see if i could run my program out of the editor. Like as you would click on any other .exe file for a program. i went into the debug folder, where the .exe file is located. when i run it, it works but when it asks me for data and i press enter it closes the box and exits.
is there some properties you have to mess with so that is actually shows the answer and not close out of the program?
-matt
 
When you click console mode exe, Windows opens console window, then the program gets your input, prints the answer and returns to Windows. Now Windows closes the window - that's all. So simply and too fast...
If you want to show your answer you (your program) must wait until an user read. You must program this behaviour.
The simplest way to do that:
Code:
system("pause"); // before return from the main()
You may also wait for an user input (getchar() or what else) but it's not so robust method.


 
Or set a breakpoint in the main's return.

/Per
[sub]
www.perfnurt.se[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top