If we want to open a file, Operating system wants to know the exact way in which the file should respond to various commands (functions). For this purpose, compiler specifies various file opening modes. Table 14.1 summarizes the various modes supported by C++.
Table 14.1 File Modes
|Sr. No||Open mode||Description|
|1||in||Open for reading|
|2||out||Open for writing|
|3||ate||Seek to end of file upon original open|
|5||trunc||Truncate file if already exists|
|6||nocreate||Open fails if file does not exists|
|7||noreplace||Open fails if file already exists|
|8||binary||Opens file as binary|
The detalied explanation of file modes is as follows.