Open
and Create
calls result in a call to fopen
using the mode shown in the following table:
Open and Create Call Modes | ||
---|---|---|
`OPEN' | `CREATE' | |
Append_File | "r+" | "w+" |
In_File | "r" | "w+" |
Out_File (Direct_IO) | "r+" | "w" |
Out_File (all other cases) | "w" | "w" |
Inout_File | "r+" | "w+" |
If text file translation is required, then either b
or t
is added to the mode, depending on the setting of Text. Text file
translation refers to the mapping of CR/LF sequences in an external file
to LF characters internally. This mapping only occurs in DOS and
DOS-like systems, and is not relevant to other systems.
A special case occurs with Stream_IO. As shown in the above table, the
file is initially opened in r
or w
mode for the
In_File
and Out_File
cases. If a Set_Mode
operation
subsequently requires switching from reading to writing or vice-versa,
then the file is reopened in r+
mode to permit the required operation.