Programmatically creating/deleting folders using gfortran
FX
fxcoudert@gmail.com
Fri May 9 17:28:00 GMT 2008
> The last item that I need to replace are the three functions:
> makedirqq, deldirqq, delfilesqq that use ifort's ifport module.
>
> Any ideas on what replacements are available for gfortran?
Two main ways to do it: 1. use the SYSTEM intrinsic, like this: CALL
SYSTEM("mkdir testdir"), and 2. use ISO_C_BINDING to access the POSIX.
1 intrinsic, like that:
program test
use iso_c_binding
interface
function mkdir(path,mode) bind(c,name="mkdir")
use iso_c_binding
integer(c_int) :: mkdir
character(kind=c_char,len=1) :: path(*)
integer(c_int16_t), value :: mode
end function mkdir
end interface
integer :: i
i = mkdir("foo", int(o'772',c_int16_t))
end
(Despite using ISO_C_BINDING, this is not completely portable as
Fortran does not have POSIX bindings: this assumes that POSIX mode_t
is a 16-bit integer.)
FX
--
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/
More information about the Fortran
mailing list