Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29542 Discussions

Executing a Windows program during a Fortran run

Paulo_M_
Beginner
7,526 Views

Hello everyone,

I am working on an optimization code, in which an external program should provide a data file, to be read by Fortran. My question is: how could I execute the external program during the Fortran run?

Thanks,

 

Paulo

 

0 Kudos
1 Solution
DavidWhite
Valued Contributor II
7,508 Views


Paulo,

You can call any command using SYSTEMQQ, which takes as an argument the command that you would use in a command or batch file.

Obviously, you would need to make sure your Fortran program closes any files needed, then you can call the program with a statement like

CALL SYSTEMQQ("C:\foldername\myprogram.exe argument1 argument2")

Then, when the program has completed, you can open the files to be analysed by your Fortran program.

Regards,

David

View solution in original post

0 Kudos
22 Replies
Steven_L_Intel1
Employee
704 Views

EXECUTE_COMMAND_LINE would be more portable, but you'd need to find a replacement for Wordpad on Linux.

0 Kudos
jimdempseyatthecove
Honored Contributor III
704 Views

>> but you'd need to find a replacement for Wordpad on Linux

export dboggs_EDITOR=gedit

IOW use an environment variable to provide the (partial) string for the EXECUTE_COMMAND_LINE.

You still have to work out issues regarding option switches and/or path separators /, \.

 

Jim Dempsey

0 Kudos
Reply