0

Possible Duplicate:
How to keep the console window open in visual c++?

I have a program that runs on my home machine, but on another machine it quits instantly when being executed. The console window opens and closes so fast that I can't read the output. How can I make sure this output stays visible, so I can read what it's trying to tell me?

Community
  • 1
  • 1
  • 2
    Try something like getch() before you return from your main function – Tom Knapen Nov 21 '11 at 17:13
  • @Mysticial that is similar, but that is just to keep it open at some predetermined point. I want it to stay open once it throws its errors –  Nov 21 '11 at 17:15
  • Ah, sorry. You didn't say that in your question, so it looked like an exact dupe. – Mysticial Nov 21 '11 at 17:16

2 Answers2

5

Since it's a console application run it from a cmd window.

OSH
  • 2,847
  • 3
  • 25
  • 46
  • 2
    +1, just execute it from the command line and you'll get the output. This is better than forcing a readline and requiring input before the app will finish. – Fosco Nov 21 '11 at 17:14
  • It's actually not solely a console application, but none of the GUI windows load before it shuts down. *edit* actually, you're right. Thank you. –  Nov 21 '11 at 17:15
0

You can set Visual Studio to break when an exception is thrown (of course this will only work if an uncaught exception is what is causing your program to terminate early).

Michael Price
  • 8,088
  • 1
  • 17
  • 24