Reputation: 11
I would like to call an executable file and give it variables in my fortran code. for example:
function obj(ii)
use omp_lib
use ifport
implicit none
integer,intent(in)::ii
integer:: thron
real::obj
thron=omp_get_thread_num()
obj=RUNQQ('C:\pgi\matlab_omp_cuda\test.exe','')
return
end function obj
In this code, "thron" is the thread no. which is a variable in another executable file.
Upvotes: 0
Views: 262
Reputation: 29391
Fortran 2008 provides the intrinsic subroutine EXECUTE_COMMAND_LINE
which will allow you to invoke an executable file. You could pass options on the command line. If the executable was created from Fortran, in the Fortran source you could read options on the the command line with the intrinsics COMMAND_ARGUMENT_COUNT
and GET_COMMAND_ARGUMENT
.
Upvotes: 2