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

Create directories using INTEL FORTRAN

bsi
Beginner
723 Views

This is hopefully a simple question:

During the execution of my application I need to createsome text files and save data in those. The data files need to becreatedin a subdirectory of the current directory (ie where the input data file is located). The problem I have is that the subdirectory cannot be created before the execution of the program since the name etc is not known before hand.

The question: Is there a way during the execution of an application to create a directory?

Any suggestion will be greatly appreciated.

Thanks,

Petros

0 Kudos
1 Reply
Steven_L_Intel1
Employee
723 Views
Sure - the Win32 API routine CreateDirectory, defined in module kernel32 Quick example

program credir
use kernel32
implicit none
integer(BOOL) ret
ret = CreateDirectory("subdir"C, NULL)
if (ret == 0) then
print *, "CreateDirectory failed, status = ", GetLastError()
end if
end program credir

0 Kudos
Reply