[fstream.syn] # 31 Input/output library [[input.output]](./#input.output) ## 31.10 File-based streams [[file.streams]](file.streams#fstream.syn) ### 31.10.1 Header synopsis [fstream.syn] [🔗](#header:%3cfstream%3e) namespace std {// [[filebuf]](filebuf "31.10.3 Class template basic_­filebuf"), class template basic_filebuftemplate>class basic_filebuf; templatevoid swap(basic_filebuf& x, basic_filebuf& y); using filebuf = basic_filebuf; using wfilebuf = basic_filebuf; // [[ifstream]](ifstream "31.10.4 Class template basic_­ifstream"), class template basic_ifstreamtemplate>class basic_ifstream; templatevoid swap(basic_ifstream& x, basic_ifstream& y); using ifstream = basic_ifstream; using wifstream = basic_ifstream; // [[ofstream]](ofstream "31.10.5 Class template basic_­ofstream"), class template basic_ofstreamtemplate>class basic_ofstream; templatevoid swap(basic_ofstream& x, basic_ofstream& y); using ofstream = basic_ofstream; using wofstream = basic_ofstream; // [[fstream]](fstream "31.10.6 Class template basic_­fstream"), class template basic_fstreamtemplate>class basic_fstream; templatevoid swap(basic_fstream& x, basic_fstream& y); using fstream = basic_fstream; using wfstream = basic_fstream;} [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10928) The header [](#header:%3cfstream%3e "31.10.1 Header synopsis [fstream.syn]") defines four class templates and eight types that associate stream buffers with files and assist reading and writing files[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10934) [*Note [1](#note-1)*: The class template basic_filebuf treats a file as a source or sink of bytes[.](#2.sentence-1) In an environment that uses a large character set, the file typically holds multibyte character sequences and the basic_filebuf object converts those multibyte sequences into wide character sequences[.](#2.sentence-2) — *end note*] [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10942) In subclause [[file.streams]](file.streams "31.10 File-based streams"), member functions taking arguments of const filesystem​::​path​::​value_type* are only provided on systems where filesystem​::​path​::​value_type ([[fs.class.path]](fs.class.path "31.12.6 Class path")) is not char[.](#3.sentence-1) [*Note [2](#note-2)*: These functions enable class path support for systems with a wide native path character type, such as wchar_t[.](#3.sentence-2) — *end note*]