C++ file I/O is done via streams. The key abstractions are:

std::istream for reading text.

std::ostream for writing text.

std::streambuf for reading or writing characters.

Formatted input uses operator>>.

Formatted output uses operator<<.

Streams use std::locale, e.g., for details of the formatting and for translation between external encodings and the internal encoding.

More on streams.

Writing to a file

Opening a file

Reading from a file

Opening modes

Reading text file into a std::string

Writing files with non-standard locale settings

Checking end of file inside a loop condition bad practice

Flushing a stream

Reading a file into a container

Copying a file

Closing a file