Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call dos command in fortran code?

Status
Not open for further replies.

sgirardi

Materials
Joined
May 1, 2003
Messages
3
Location
CH
Hello,

I want to call a dos command in my fortran 90 code and I d'ont know how to do. Can somebody help me?

Thank's.
 
A way to do that is to use the function called systemqq in the MSFLIB (or DFLIB in some cases). By example

program XXX

use msflib

character(len=3) :: command
logical :: result

command = 'dir'
result = systemqq (command)

end program XXX

will execute the dir command.


 
Actually, there is no standard way of executing a DOS command or any other program executable from within a Fortran program. The Fortran standard does not attempt to address such issues as they are dependant on the hardware and operating system and compiler being used.

However... I doubt that there are any F90 compilers that can't do these things. The "CALL SYSTEM( )" command is a fairly common extension used by many compiler vendors. You'll have to look in your compilers documentation to be sure how to do it correctly. People here can only guess and tell you what their particular compiler can do.

Dan :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top