Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Keeping Console App Window Open After Program Termination

Ioannis_K_
New Contributor I
2,953 Views

Hello,

I have built a console application using the Visual Fortran compiler with Visual Studio. When my application is terminated (either due to normal termination or due to a fatal error) the console window immediately closes. 

I would like to ask if there is a way to maintain the console window open after the program is terminated. This will be useful for situations where I have abnormal termination. Alternatively, is it possible to duplicate the "screen print" of the console window to a file?

Any help on this will be greatly appreciated.

0 Kudos
4 Replies
andrew_4619
Honored Contributor III
2,953 Views
I might be wrong on this but I think if you create a CMD window on run your app from it then output will go to that window rather than a new console created at the app launch.
0 Kudos
Ioannis_K_
New Contributor I
2,952 Views

I agree, but this is not what I want. I want to double-click on the app to run it, instead of having to run it from cmd

0 Kudos
Steve_Lionel
Honored Contributor III
2,952 Views

Once the program returns from the main program, Windows closes the console window. But take a look at https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/275071#comment-1548443 for an alternative.

0 Kudos
Busch__Thorben
Beginner
2,953 Views

Hey,

just write a

     ...

     READ(*,*)

right before

END PROGRAM ...

so you have a kind of "press enter to close" ;)

0 Kudos
Reply