O'Reilly logo

Object Oriented Programming with C++, Second Edition by Sunil Patekar, Mahesh Bhave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14.6 FILE OPENING MODES

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
4 app Append mode
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.

  1. (in) This mode should be specified for input files.
  2. (out) This mode ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required