The Wayback Machine - https://web.archive.org/web/20230708163338/https://ja.cppreference.com/w/cpp/header/fstream
名前空間
変種
操作

標準ライブラリヘッダ <fstream>

提供: cppreference.com
< cpp‎ | header
 
 
 

このヘッダは入出力ライブラリの一部です。

目次

クラス

生のファイルデバイスを実装します
(クラステンプレート)[edit]
高水準のファイルストリーム入力操作を実装します
(クラステンプレート)[edit]
高水準のファイルストリーム出力操作を実装します
(クラステンプレート)[edit]
高水準のファイルストリーム入出力操作を実装します
(クラステンプレート)[edit]
filebufstd::basic_filebuf<char>
(typedef)
wfilebufstd::basic_filebuf<wchar_t>
(typedef)
ifstreamstd::basic_ifstream<char>
(typedef)
wifstreamstd::basic_ifstream<wchar_t>
(typedef)
ofstreamstd::basic_ofstream<char>
(typedef)
wofstreamstd::basic_ofstream<wchar_t>
(typedef)
fstreamstd::basic_fstream<char>
(typedef)
wfstreamstd::basic_fstream<wchar_t>
(typedef)

関数

std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]
std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]
std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]
std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]

[編集]概要

namespace std {template<class charT, class traits = char_traits<charT>>class basic_filebuf;using filebuf = basic_filebuf<char>;using wfilebuf = basic_filebuf<wchar_t>;   template<class charT, class traits = char_traits<charT>>class basic_ifstream;using ifstream = basic_ifstream<char>;using wifstream = basic_ifstream<wchar_t>;   template<class charT, class traits = char_traits<charT>>class basic_ofstream;using ofstream = basic_ofstream<char>;using wofstream = basic_ofstream<wchar_t>;   template<class charT, class traits = char_traits<charT>>class basic_fstream;using fstream = basic_fstream<char>;using wfstream = basic_fstream<wchar_t>;}

[編集]クラステンプレート std::basic_filebuf

namespace std {template<class CharT, class Traits = char_traits<CharT>>class basic_filebuf :public basic_streambuf<CharT, Traits>{public:using char_type = CharT;using int_type =typename Traits::int_type;using pos_type =typename Traits::pos_type;using off_type =typename Traits::off_type;using traits_type = Traits;   // constructors/destructor basic_filebuf(); basic_filebuf(const basic_filebuf&)= delete; basic_filebuf(basic_filebuf&& rhs);virtual ~basic_filebuf();   // assign and swap basic_filebuf& operator=(const basic_filebuf&)= delete; basic_filebuf& operator=(basic_filebuf&& rhs);void swap(basic_filebuf& rhs);   // membersbool is_open()const; basic_filebuf* open(constchar* s, ios_base::openmode mode); basic_filebuf* open(const filesystem::path::value_type* s, ios_base::openmode mode);// wide systems only basic_filebuf* open(const string& s, ios_base::openmode mode); basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode); basic_filebuf* close();   protected:// overridden virtual functions streamsize showmanyc() override; int_type underflow() override; int_type uflow() override; int_type pbackfail(int_type c = Traits::eof()) override; int_type overflow (int_type c = Traits::eof()) override;   basic_streambuf<CharT, Traits>* setbuf(char_type* s, streamsize n) override; pos_type seekoff(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in| ios_base::out) override; pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in| ios_base::out) override;int sync() override;void imbue(const locale& loc) override;};   template<class CharT, class Traits>void swap(basic_filebuf<CharT, Traits>& x, basic_filebuf<CharT, Traits>& y);}

[編集]クラステンプレート std::basic_ifstream

namespace std {template<class CharT, class Traits = char_traits<CharT>>class basic_ifstream :public basic_istream<CharT, Traits>{public:using char_type = CharT;using int_type =typename Traits::int_type;using pos_type =typename Traits::pos_type;using off_type =typename Traits::off_type;using traits_type = Traits;   // constructors basic_ifstream();explicit basic_ifstream(constchar* s, ios_base::openmode mode = ios_base::in);explicit basic_ifstream(const filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in);// wide systems onlyexplicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in);explicit basic_ifstream(const filesystem::path& s, ios_base::openmode mode = ios_base::in); basic_ifstream(const basic_ifstream&)= delete; basic_ifstream(basic_ifstream&& rhs);   // assign and swap basic_ifstream& operator=(const basic_ifstream&)= delete; basic_ifstream& operator=(basic_ifstream&& rhs);void swap(basic_ifstream& rhs);   // members basic_filebuf<CharT, Traits>* rdbuf()const;   bool is_open()const;void open(constchar* s, ios_base::openmode mode = ios_base::in);void open(const filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in);// wide systems onlyvoid open(const string& s, ios_base::openmode mode = ios_base::in);void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);void close();private: basic_filebuf<CharT, Traits> sb;// exposition only};   template<class CharT, class Traits>void swap(basic_ifstream<CharT, Traits>& x, basic_ifstream<CharT, Traits>& y);}

[編集]クラステンプレート std::basic_ofstream

namespace std {template<class CharT, class Traits = char_traits<CharT>>class basic_ofstream :public basic_ostream<CharT, Traits>{public:using char_type = CharT;using int_type =typename Traits::int_type;using pos_type =typename Traits::pos_type;using off_type =typename Traits::off_type;using traits_type = Traits;   // constructors basic_ofstream();explicit basic_ofstream(constchar* s, ios_base::openmode mode = ios_base::out);explicit basic_ofstream(const filesystem::path::value_type* s, // wide systems only ios_base::openmode mode = ios_base::out);explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out);explicit basic_ofstream(const filesystem::path& s, ios_base::openmode mode = ios_base::out); basic_ofstream(const basic_ofstream&)= delete; basic_ofstream(basic_ofstream&& rhs);   // assign and swap basic_ofstream& operator=(const basic_ofstream&)= delete; basic_ofstream& operator=(basic_ofstream&& rhs);void swap(basic_ofstream& rhs);   // members basic_filebuf<CharT, Traits>* rdbuf()const;   bool is_open()const;void open(constchar* s, ios_base::openmode mode = ios_base::out);void open(const filesystem::path::value_type* s, ios_base::openmode mode = ios_base::out);// wide systems onlyvoid open(const string& s, ios_base::openmode mode = ios_base::out);void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);void close();private: basic_filebuf<CharT, Traits> sb;// exposition only};   template<class CharT, class Traits>void swap(basic_ofstream<CharT, Traits>& x, basic_ofstream<CharT, Traits>& y);}

[編集]クラステンプレート std::basic_fstream

namespace std {template<class CharT, class Traits = char_traits<CharT>>class basic_fstream :public basic_iostream<CharT, Traits>{public:using char_type = CharT;using int_type =typename Traits::int_type;using pos_type =typename Traits::pos_type;using off_type =typename Traits::off_type;using traits_type = Traits;   // constructors basic_fstream();explicit basic_fstream(constchar* s, ios_base::openmode mode = ios_base::in| ios_base::out);explicit basic_fstream(const filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in| ios_base::out);// wide systems onlyexplicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in| ios_base::out);explicit basic_fstream(const filesystem::path& s, ios_base::openmode mode = ios_base::in| ios_base::out); basic_fstream(const basic_fstream&)= delete; basic_fstream(basic_fstream&& rhs);   // assign and swap basic_fstream& operator=(const basic_fstream&)= delete; basic_fstream& operator=(basic_fstream&& rhs);void swap(basic_fstream& rhs);   // members basic_filebuf<CharT, Traits>* rdbuf()const;bool is_open()const;void open(constchar* s, ios_base::openmode mode = ios_base::in| ios_base::out);void open(const filesystem::path::value_type* s, ios_base::openmode mode = ios_base::in| ios_base::out);// wide systems onlyvoid open(const string& s, ios_base::openmode mode = ios_base::in| ios_base::out);void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in| ios_base::out);void close();   private: basic_filebuf<CharT, Traits> sb;// exposition only};   template<class CharT, class Traits>void swap(basic_fstream<CharT, Traits>& x, basic_fstream<CharT, Traits>& y);}
close