インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

OPEN: FILE Specifier

The FILE specifier indicates the name of the file to be connected to the unit. It takes the following form:

FILE = name

name

Is a character or numeric expression.

The name can be any pathname allowed by the operating system.

Any trailing blanks in the name are ignored.

If the following conditions occur:

then Intel® Fortran generates a file name in the form fort.n, where n is the logical unit number. On Windows systems, if compiler option fpscomp general is specified, omitting FILE implies STATUS='SCRATCH'.

If the file name is stored in a numeric scalar or array, the name must consist of ASCII characters terminated by an ASCII null character (zero byte). However, if it is stored in a character scalar or array, it must not contain a zero byte.

On Windows systems, if the filename is 'USER' or 'CON', input and output are directed to the console. .

In a Windows* QuickWin application, you can specify FILE='USER' to open a child window. All subsequent I/O statements directed to that unit appear in the child window.

On Windows systems, the name can be blank (FILE=' ') if the compatibility compiler option fpscomp filesfromcmd is specified. If the name is blank, the following occurs:

  1. The program reads a filename from the list of arguments (if any) in the command line that started the program. If the argument is a null or blank string (" "), you are prompted for the corresponding filename. Each successive OPEN statement that specifies a blank name reads the next following command-line argument.

  2. If no command-line arguments are specified or there are no more arguments in the list, you are prompted for additional filenames.

    Assume the following command line started the program MYPROG (note that quotation marks (") are used):

    myprog first.fil " " third.txt

    MYPROG contains four OPEN statements with blank filenames, in the following order:

       OPEN (2, FILE = ' ')
       OPEN (4, FILE = ' ')
       OPEN (5, FILE = ' ')
       OPEN (10, FILE = ' ')

    Unit 2 is associated with the file FIRST.FIL. Because a blank argument was specified on the command line for the second filename, the OPEN statement for unit 4 produces the following prompt:

     Filename missing or blank - Please enter name UNIT 4?

    Unit 5 is associated with the file THIRD.TXT. Because no fourth file was specified on the command line, the OPEN statement for unit 10 produces the following prompt:

     Filename missing or blank - Please enter name UNIT 10?

See Also