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 application

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
Hello,
I have never done any console programming and I have a question which I'm sure has a very simple answer. When my application runs, it outputs some data to the console window and then closes. How do I keep it from closing so that I can view the results?

Thanks
 
OTTOMH:

1. declare int Main() and put a breakpoint on the final return 0;.
2. insert a Debug.Print(); statement and break on that.
3. use a Debug.Assert(false, "message"); at the end.
4. step through your code line by line and look at the console window for the output.
5. break on every Console.Write?(); statement and use f10 to step over them.
6. declare a method ConsoleWrite with the same footprint as Console.Write which not only calls Console.Write but also outputs it to a logfile.

hth,


mr s. <;)

 
OR you can write this:


Console.WriteLine( "Press <ENTER> to close.");
Console.ReadLine();
 
You can also put a Console.ReadLine() at the end of your code so that a user has to hit enter to actually close.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top