fstream::open

void open( const char* szName, int nMode, int nProt = filebuf::openprot );

Opens a disk file and attaches it to the stream’s filebuf object.

Parameters

szName

The name of the file to be opened during construction.

nMode

An integer containing mode bits defined as ios enumerators that can be combined with the OR ( | ) operator. See the fstream constructor for a list of the enumerators. There is no default; a valid mode must be specified.

nProt

The file protection specification; defaults to the static integer filebuf::openprot. See the fstream constructor for a list of the other allowed values.

Remarks

If the filebuf object is already attached to an open file, or if a filebuf call fails, the ios::failbit is set. If the file is not found, then the ios::failbit is set only if the ios::nocreate mode was used.

fstream OverviewInput Stream Classes

See Also   filebuf::open, fstream::fstream, fstream::close, fstream::is_open