forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DOS Window does not stay active

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
fkaram65



Joined: 14 Jan 2015
Posts: 2

PostPosted: Thu Jan 15, 2015 3:37 am    Post subject: DOS Window does not stay active Reply with quote

Hello,


New to programming fortran. I make a simple program and build and compiled to get the .exe file. When I run it within the Plato IDE is runs fine with the dos window coming up. This window then states press a key to close the window. No problem.

However, when I just run the executable, out of the plato environment, the dos window flashes up and go away. I am running windows 7 64 bit.

any thoughts would be appreciated.
thanks
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Jan 15, 2015 5:43 am    Post subject: Reply with quote

post small text example
Back to top
View user's profile Send private message
fkaram65



Joined: 14 Jan 2015
Posts: 2

PostPosted: Thu Jan 15, 2015 5:46 am    Post subject: sample code Reply with quote

Program temp

!program declarations
implicit none
Real :: f
Real :: c

print*,'Please enter the temperature in Fahrenheit (F):'
read*,f

c = (f-32.)*(5./9.)

print*,'-----------------------------------------'
print*,'----------------Input Values-------------'
print*,'-----------------------------------------'
print*,'Input Temperature', f, '(F)'
print*,'-----------------------------------------'
print*,'-----------Calculated Values-------------'
print*,'-----------------------------------------'
print*,'Converted Temperature', c,'(C)'
print*,'-----------------------------------------'
print*,'-----------------------------------------'

end program temp
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Thu Jan 15, 2015 8:57 am    Post subject: Reply with quote

The command (DOS) window is supposed to disappear when the program ends. This is by design and there isn't an option to change it with this compiler (AFAIK).

If you are writing an application that is supposed to run in a command window then it is best to run it from a command window (rather than double-clicking in Windows Explorer).

You can get a command window by pressing SHIFT on the keyboard and right-click in the Explorer window. Select "Open Command Window here". (doesn't work on XP though). Then type the name of your program to run it.

Alternatively you can put a PAUSE statement at the end of your program which will let you run from Explorer and persist the command window.

BTW I like your small example, but this is much smaller and illustrates your point:

Code:

END

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Jan 15, 2015 1:20 pm    Post subject: Reply with quote

Yes I have seen this when double clicking a .exe from explorer.
Try putting ther keyword "WINAPP" as the first line or your program above the program line and try again. At least then an "Output" window will be created and you can actually tell if the program is running.

Try running it from the command window.

If that doesn't work, then check that salflibc.dll is in a suitable place to be found. For example place a copy in the same directory as the executable.
Back to top
View user's profile Send private message Send e-mail
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Jan 18, 2015 10:40 am    Post subject: Reply with quote

FTN95 is not like your other plain usual boring Fortran compilers. Here you also can with just one additional line of text create your own much more manageable DOS-like window. You can control its size, colors, fonts, backgrounds, logical unit, all will still fit in one line. You can insert its window into large environment. Here is whole your program again.

Code:
winapp
i=winio@('%60.20cw[vscroll]%ac[esc]%lw',0,'exit',ilw)

1 print*,'==============================================='
 print*,'Please enter the temperature in Fahrenheit (F):'
 read*,f

 c = (f-32.)*(5./9.)

 print*,'-----------------------------------------'
 print*,'----------------Input Values-------------'
 print*,'-----------------------------------------'
 print*,'Input Temperature', f, '(F)'
 print*,'-----------------------------------------'
 print*,'-----------Calculated Values-------------'
 print*,'-----------------------------------------'
 print*,'Converted Temperature', c,'(C)'
 print*,'-----------------------------------------'
 print*,'-----------------------------------------'
 goto 1
end



You can learn other tricks on similar program which converts F to C in this forum's Suggestions/User Examples
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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