Opening Text Stream and Binary Stream Files
Each text stream file and each binary stream file is represented by a
file control structure of type file. This structure is initialized
depending on the mode in which the file was opened. Unpredictable results
might occur if you attempt to change the file control structure.
The format of
fopen() is:
#include <stdio.h>
FILE *fopen(const char *filename, const char *mode);The mode variable is a character string that consists of an open mode which may be followed by keyword parameters. The open mode and keyword parameters must be separated by a comma or one or more blank characters.
To open a text stream file, use
fopen() with one of the following
modes:
rorr+worw+aora+
To open a binary stream file, use
fopen() with one of the following
modes:
rb,rb+, orr+bwb,wb+orw+bab,awb+ora+b

open() member function
with ios::binary, or any of the following modes:
ios::appios::ateios::inios::outios::trunc