Programmatically creating/deleting folders using gfortran
Richard Otero
rich.otero@gmail.com
Fri May 9 17:39:00 GMT 2008
Thank you for your really quick feedback!
As far as portability, I'm also trying to find a solution that would
work on both my debian machine my labmates Windows machines.
On Fri, May 9, 2008 at 1:28 PM, FX <fxcoudert@gmail.com> wrote:
>> 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