/* related posts with thumb nails */

File Opening Modes:

“fstream” class allows to open a file in any specified mode with its objects.
All these mode specifiers are defined in “ios” class.

The different modes of opening a file are discussed below:
Mode
Meaning
in
Opens a file for reading
out
Opens a file for reading
app
Opens a file for appending
ate
Moves the file to end for reading or witing
binary
Opens a file in binary mode
nocreate
Error when opening if file does not exist
noreplace
Error when opening if file exists


Syntax:
            fstream f;
    f.open(filename, ios::in | ios::out)

Explanation:
The above code opens a file in both read and write modes. Programmer can both read into or write from a file.
Related Topics:

0 comments:

Post a Comment