Language | ||||
Standard Library Headers | ||||
Freestanding and hosted implementations | ||||
Named requirements | ||||
Language support library | ||||
Concepts library(C++20) | ||||
Diagnostics library | ||||
Utilities library | ||||
Strings library | ||||
Containers library | ||||
Iterators library | ||||
Ranges library(C++20) | ||||
Algorithms library | ||||
Numerics library | ||||
Localizations library | ||||
Input/output library | ||||
Filesystem library(C++17) | ||||
Regular expressions library(C++11) | ||||
Atomic operations library(C++11) | ||||
Thread support library(C++11) | ||||
Technical Specifications |
I/O manipulators | ||||
C-style I/O | ||||
Buffers | ||||
(deprecated in C++98) | ||||
(C++20) | ||||
Streams | ||||
Abstractions | ||||
File I/O | ||||
String I/O | ||||
Array I/O | ||||
(deprecated in C++98) | ||||
(deprecated in C++98) | ||||
(deprecated in C++98) | ||||
Synchronized Output | ||||
(C++20) | ||||
Types | ||||
Error category interface | ||||
(C++11) | ||||
(C++11) |
Member functions | ||||
(C++11) | ||||
(C++11) | ||||
File operations | ||||
Non-member functions | ||||
(C++11) |
void open(constchar*filename, ios_base::openmode mode = ios_base::in|ios_base::out); | (1) | |
void open(const std::filesystem::path::value_type*filename, ios_base::openmode mode = ios_base::in|ios_base::out); | (2) | (since C++17) |
void open(conststd::string&filename, ios_base::openmode mode = ios_base::in|ios_base::out); | (3) | (since C++11) |
void open(conststd::filesystem::path&filename, ios_base::openmode mode = ios_base::in|ios_base::out); | (4) | (since C++17) |
filename
with the file stream.Calls clear() on success. | (since C++11) |
filename | - | the name of the file to be opened | ||||||||||||||
mode | - | specifies stream open mode. It is bitmask type, the following constants are defined:
|
checks if the stream has an associated file (public member function)[edit] |
closes the associated file (public member function)[edit] |
opens a file and configures it as the associated character sequence (public member function of std::basic_filebuf<CharT,Traits> )[edit] |