Open andCreate calls result in a call tofopenusing the mode shown in the following table:
Open andCreate Call ModesOPENCREATE 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 filetranslation refers to the mapping of CR/LF sequences in an external fileto LF characters internally. This mapping only occurs in DOS andDOS-like systems, and is not relevant to other systems.
A special case occurs with Stream_IO. As shown in the above table, thefile is initially opened in ‘r’ or ‘w’ mode for theIn_File andOut_File cases. If aSet_Mode operationsubsequently requires switching from reading to writing or vice-versa,then the file is reopened in ‘r+’ mode to permit the required operation.