=====open=====
Syntax:
#include
void open( const char *filename );
void open( const char *filename, openmode mode = default_mode );
The function open() is used with file streams. It opens filename and associates
it with the current stream. The optional io_stream_mode_flag mode defaults to
ios::in for ifstream, ios::out for ofstream, and ios::in|ios::out for fstream.
If open() fails, the resulting stream will evaluate to false when used in a
Boolean expression. For example:
ifstream inputStream;
inputStream.open("file.txt");
if( !inputStream ) {
cerr << "Error opening input stream" << endl;
return;
}
Related Topics: [[I/O_Constructors]], [[close]], [[io_flags#mode_flags|C++ I/O Mode Flags]]