Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Console termination options

maciej
Beginner
1,151 Views
Dears,

I looked into documentation in the compilation options but did not find a switch not to close the console window after program terminates. It is often that I need to see what happened in the IMSL - I redirected the error to file but I prefer to see them on the console window.
And I do not know if it is default behaviour but it seems so - when I start console program it hides running under the VS2008 window - it is not good because if something fails at the beginning I'm sometimes even not able to switch into that window because it finishes and disappears immediately.

Maciej
0 Kudos
1 Solution
Steven_L_Intel1
Employee
1,151 Views

If you use "Start without debugging", then the console window will stay up after the program exits. If you start it under the debugger, then the window will go away when the program exits and there is no switch to control that.

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,152 Views

If you use "Start without debugging", then the console window will stay up after the program exits. If you start it under the debugger, then the window will go away when the program exits and there is no switch to control that.
0 Kudos
virtualmemory
Beginner
1,151 Views
Is there a way for a Fortran console app to trap fatal Fortran run-time errors, so either (1) the user sees the error traceback on the console; or (2) a developer-written pgm gets control, and can obtain the traceback?

What happens otherwise is that the user (who is not using a debugger, naturally) sees the console window flash and then disappear, with no indication for anyone of what error has occurred.
0 Kudos
qolin
Novice
1,151 Views
Easiest fix is to use a small .BAT file to start the app.
So for example to start off APP.EXE you could create APP.BAT, containing:
APP.EXE
PAUSE
if APP.BAT resides in the same folder as APP.EXE, then double-clicking on APP.BAT will run APP.EXE. Then when it terminates (or crashes) the PAUSE command writes "Press any key to continue . . .", and the console duly sits there until you find the "any" key.
Fancier alternatives include creating a QuickWin app instead of a console app.
The .BAT file method can be extended to test the ERRORLEVEL flag so as to detect a normal termination and close immediately, and to PAUSE only when a crash (or other abnormal termination) has occurred.
Another obvious (to me at least) method is to start off your own Command prompt console, CD to the folder containing APP.exe, and start it running by typing APP. Then when it finishes, the console won't dissappear, and you can run it again, or do something else useful with it.
0 Kudos
Reply