Silverfrost Forums

Welcome to our forums

problems with output window

9 Feb 2011 7:44 #7728

hey guys,

I am new to fortran and FTN 95. I know how to write simple programs for scientific calculations. The problem is my output window flases for a nano second before disappearing. I dont know how to fix that. I tried the same program on other fortran compilers and it works fine also I tried it on different windows platform with same results.

I wonder if there is option to make the output window appear longer?

FYI: I am running Express version with checkmate. Thanks

9 Feb 2011 8:01 #7729

two possibilities:

  1. put a pause or read statement at the end of your program to delay it's ending. If you are running the program by double clicking program.exe from explorer, this will fix the problem. character answer

... (your program) ...

read (,) answer end

  1. Open a command prompt window and run your program in that window. All the screen output will appear in the command window.
10 Feb 2011 9:39 #7734

how do i run it in command prompt? an example code would be very helpful.

thanks

10 Feb 2011 11:26 #7741

I'm assuming you are too young to be familiar with MS-DOS. on my Win-XP OS, on the Taskbar select 'Start' select Run... type 'cmd.exe' in open box, then select 'OK'

This should open a 'Command Prompt' or previously called a 'Dos Box' Our world of old style computing will open up to you !! In the Command Prompt window use CD your_path to go to where the program is and then type the program executable name. HELP will give you all the commands available.

I don't have Windows 7 for the latest, but I hope it is similar.

Alternatively, assuming you are selecting your program executable through Windows Explorer, I have included a code example below showing the use of PAUSE or use of a read statement to delay exit from my program. Note that when the program runs, it creates a command prompt box to run in. ! Program to test values of KIND ! character answer integer4 i,p,r ! do p = 6,7 do r = 37,38 i = selected_real_kind (p,r) write (,) '(p,r,kind) = ',p,r,i end do end do ! i = kind(0.0) write (,) '(0.00) = ',i ! i = kind(0.0d00) write (,) '(0.00d00) = ',i ! i = selected_real_kind (8,30) write (,) '(8,30) = ',i ! i = selected_real_kind (7,30) write (,) '(7,30) = ',i ! i = selected_real_kind (6,30) write (,) '(6,30) = ',i ! ! Both the following work as a delay ! pause ! write (,) 'wait to end ??' read (,fmt='(a)') answer end

John

12 Feb 2011 12:21 #7746

Excellent advise from John.

:idea: With Windows 7 (and Vista) you can quickly get a command prompt and move to a directory by holding down Shift and right-clicking the mouse on an empty part of a folder in Windows explorer. Then pick 'Open a command window here'.

It doesn't work in XP but there is an application you can load to add this functionality.

Please login to reply.