Files
2025-10-25 03:02:53 +03:00

3.1 KiB
Raw Permalink Blame History

[fstream.syn]

31 Input/output library [input.output]

31.10 File-based streams [file.streams]

31.10.1 Header synopsis [fstream.syn]

🔗

namespace std {// [filebuf], class template basic_filebuftemplate<class charT, class traits = char_traits>class basic_filebuf; template<class charT, class traits>void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y); using filebuf = basic_filebuf; using wfilebuf = basic_filebuf<wchar_t>; // [ifstream], class template basic_ifstreamtemplate<class charT, class traits = char_traits>class basic_ifstream; template<class charT, class traits>void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y); using ifstream = basic_ifstream; using wifstream = basic_ifstream<wchar_t>; // [ofstream], class template basic_ofstreamtemplate<class charT, class traits = char_traits>class basic_ofstream; template<class charT, class traits>void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y); using ofstream = basic_ofstream; using wofstream = basic_ofstream<wchar_t>; // [fstream], class template basic_fstreamtemplate<class charT, class traits = char_traits>class basic_fstream; template<class charT, class traits>void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y); using fstream = basic_fstream; using wfstream = basic_fstream<wchar_t>;}

1

#

The header defines four class templates and eight types that associate stream buffers with files and assist reading and writing files.

2

#

[Note 1:

The class template basic_filebuf treats a file as a source or sink of bytes.

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.

— end note]

3

#

In subclause [file.streams], member functions taking arguments of const filesystem::path::value_type* are only provided on systems where filesystem::path::value_type ([fs.class.path]) is not char.

[Note 2:

These functions enable class path support for systems with a wide native path character type, such as wchar_t.

— end note]