Partilhar via


basic_fstream::open

Opens a file.

void open(
    const char *_Filename,
    ios_base::openmode _Mode = ios_base::in | ios_base::out,
    int _Prot = (int)ios_base::_Openprot
);
void open(
    const char *_Filename,
    ios_base::openmode _Mode
);
void open(
    const wchar_t *_Filename,
    ios_base::openmode _Mode = ios_base::in | ios_base::out,
    int _Prot = (int)ios_base::_Openprot
);
void open(
    const wchar_t *_Filename,
    ios_base::openmode _Mode
);

Parameters

  • _Filename
    The name of the file to open.

  • _Mode
    One of the enumerations in ios_base::openmode.

  • _Prot
    The default file opening protection, equivalent to the shflag parameter in _fsopen, _wfsopen.

Remarks

The member function calls rdbuf -> open(_Filename, _Mode). If that function returns a null pointer, the function calls setstate(failbit).

Example

See basic_filebuf::open for an example of how to use open.

Requirements

Header: <fstream>

Namespace: std

See Also

Reference

basic_fstream Class

iostream Programming

iostreams Conventions

Other Resources

basic_fstream Members