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

How to handle a runtime specified file in the program

paulgerard
Beginner
732 Views
Using the /fpscomp:filesfromcmd option I can specify which file should be opened by the program.
Running f.e. MyProg.exe Test.Out opens test.out on the first Open statement.
But in this way the program only opens the file, allowing to read, write, delete etc by unit number. How to proceed if my program must actually handle the file name, f.e. producing derived files like Test1.out, test2.out, test3.out. Then in some way the actual filename must be accessible within the program. Maybe using getArg?
0 Kudos
2 Replies
hweisberg
Beginner
732 Views
Do you mean something like

open(6, File='Test.dat', RECORDTYPE='STREAM')
0 Kudos
Steven_L_Intel1
Employee
732 Views
Look at the GETOPENFILENAME example program.

Steve
0 Kudos
Reply