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

Executable program calling by a dialog box and mix C with Fortran

janviech
Beginner
404 Views
hello,
I've a problem to call an executable program with fortran windows application. I tried with 'systemqq' but it doesn't function and i found the instruction 'createprocess' but i don't know to make it compiling. Is an instruction of language C? in this case, how can i do to write a C-program with developer studio and mix it with my fortran program?
Thank you and sorry for my bad english!

0 Kudos
2 Replies
Les_Neilson
Valued Contributor II
404 Views

No need to fo to C

You probably just forgot the USE IFPORT statement.

use IFPORT! Needed to get systemqq

integer :: ierr! Error code

character(len=80) :: command! variable to hold the command string

command = "c:pathprogram.exe arg1 arg2 etc"! The command string

if (systemqq(command)) then

ierr = 0! success

else

ierr = 1! failed

endif

Note: You could also use SYSTEM which is an integer function ie returns an integer(SYSTEMQQ is a logical function, returns a logical value)

Hope this helps

Les

0 Kudos
janviech
Beginner
404 Views
Thank you for your answer, it functions but when I want to put an argument which is a filename (variable I open with a dialog box) it doesn't function.
And do you know how I can correctly close a DOS Windows (my executable program) when I have finished to run the program and to return to the last dialog box?

Thank you for your help

Charlotte

here my code:

use ifport
integer::ierr
character(len=80) command
character(len=80) FICHIE ! filename opened with getopenfilename

command=("multi FICHIE") !i'd write it "multi filename" as command line in DOS

if (systemqq(command)) then

ierr = 0! success

else

ierr = 1! failed

endif




0 Kudos
Reply