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

call system

ekeom
Novice
789 Views
Dear all,

I would like to use this fortran instruction : call system('aut_xxx',result). Where aut_xxx is an excecutable and result an integer. In aut_xxx.f90, I have instructions like :

if(condition) then
stop 1
endif

I would like to get (in the main program) the value 1 in result (result=1). It does not work. Can someone help me?

Best regrads,

Didace
0 Kudos
1 Reply
TimP
Honored Contributor III
789 Views

In order to use system(), you must conform with the usage shown in the ifort help menu:

USE IFPORT
integer result
...
result = system("aut_xxx")
if(result == -1)then
result = ierrno()
write(*,*)'system() error:',result
endif

As system() is not a Fortran standard, there are various versions, an integer function version being the most common. The USE file actually replaces it by SYSTEMQQ, I believe.
0 Kudos
Reply