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

Opening a file for input

Mark_Gracey
Beginner
728 Views
Hi
In the program myintelprog.f please explain the syntax...
ICHAN=11
OPEN (ICHAN,FILE=' ',IOSTAT=IERR)

I am calling the fortran executable with an argument which is the full path and name of the input file.
myintelprog.exe c:\\temp\\input.txt

I am continually getting an IERR value of 29.

I believe the previous author (unavailable) was doing something clever I don't understand but the above open statement used to successfully open the file specified after myintelprog.exe

Thanks for any help.
0 Kudos
2 Replies
Arjen_Markus
Honored Contributor II
728 Views
The program seems to rely on a non-standard feature (I know it from MS Fortran Powerstation and the like).
When writing/reading from/to a file that has not been opened yet, executables created with that compiler
would use the command-line arguments to fill in the file name.

Apparently this could also be done with a blank file name in the OPEN statement.

The Intel Fortran compiler has an option to mimick that behaviour, but I prefer to explicitly get the
command-line arguments (standardised in Fortran 2003).

Regards,

Arjen
0 Kudos
Mark_Gracey
Beginner
728 Views
Thank you....I suspected as much.
Regards
Mark
0 Kudos
Reply