 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
pky5000
Joined: 04 Feb 2011 Posts: 2
|
Posted: Wed Feb 09, 2011 8:44 am Post subject: problems with output window |
|
|
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 |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Wed Feb 09, 2011 9:01 am Post subject: |
|
|
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
2) Open a command prompt window and run your program in that window. All the screen output will appear in the command window. |
|
Back to top |
|
 |
pky5000
Joined: 04 Feb 2011 Posts: 2
|
Posted: Thu Feb 10, 2011 10:39 am Post subject: |
|
|
how do i run it in command prompt?
an example code would be very helpful.
thanks |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Fri Feb 11, 2011 12:26 am Post subject: |
|
|
I'm assuming you are too young to be familiar with MS-DOS.
on my Win-XP OS,
on the Taskbar select "Start" {bottom left}
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. Code: | ! Program to test values of KIND
!
character answer
integer*4 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 |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Sat Feb 12, 2011 1:21 am Post subject: |
|
|
Excellent advise from John.
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. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|