名前空間
変種
操作

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

提供: cppreference.com
< cpp‎ | header
 
 
 

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

目次

クラス

生のファイルデバイスを実装します
(クラステンプレート) [edit]
高水準のファイルストリーム入力操作を実装します
(クラステンプレート) [edit]
高水準のファイルストリーム出力操作を実装します
(クラステンプレート) [edit]
高水準のファイルストリーム入出力操作を実装します
(クラステンプレート) [edit]

typedef

filebuf basic_filebuf<char>
wfilebuf basic_filebuf<wchar_t>
ifstream basic_ifstream<char>
wifstream basic_ifstream<wchar_t>
ofstream basic_ofstream<char>
wofstream basic_ofstream<wchar_t>
fstream basic_fstream<char>
wfstream basic_fstream<wchar_t>

関数

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;
typedef basic_filebuf<char> filebuf;
typedef basic_filebuf<wchar_t> wfilebuf;
template <class charT, class traits>
    void swap(basic_filebuf<charT, traits>& x,
              basic_filebuf<charT, traits>& y);
 
template <class charT, class traits = char_traits<charT> >
    class basic_ifstream;
typedef basic_ifstream<char> ifstream;
typedef basic_ifstream<wchar_t> wifstream;
template <class charT, class traits>
    void swap(basic_ifstream<charT, traits>& x,
              basic_ifstream<charT, traits>& y);
 
template <class charT, class traits = char_traits<charT> >
    class basic_ofstream;
typedef basic_ofstream<char> ofstream;
typedef basic_ofstream<wchar_t> wofstream;
template <class charT, class traits>
    void swap(basic_ofstream<charT, traits>& x,
              basic_ofstream<charT, traits>& y);
 
template <class charT, class traits = char_traits<charT> >
    class basic_fstream;
typedef basic_fstream<char> fstream;
typedef basic_fstream<wchar_t> wfstream;
template <class charT, class traits>
    void swap(basic_fstream<charT, traits>& x,
              basic_fstream<charT, traits>& y);
}

[編集] クラス std::basic_filebuf

template <class charT, class traits = char_traits<charT> >
class basic_filebuf : public basic_streambuf<charT,traits> {
 public:
    typedef charT char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits traits_type;
 
    // Constructors/destructor:
    basic_filebuf();
    basic_filebuf(const basic_filebuf& rhs) = delete;
    basic_filebuf(basic_filebuf&& rhs);
    virtual ~basic_filebuf();
 
    // Assign/swap:
    basic_filebuf& operator=(const basic_filebuf& rhs) = delete;
    basic_filebuf& operator=(basic_filebuf&& rhs);
    void swap(basic_filebuf& rhs);
 
    // Members:
    bool is_open() const;
    basic_filebuf<charT,traits>* open(const char* s, ios_base::openmode mode);
    basic_filebuf<charT,traits>* open(const string& s, ios_base::openmode mode);
    basic_filebuf<charT,traits>* close();
 
 protected:
    // Overridden virtual functions:
    virtual streamsize showmanyc();
    virtual int_type underflow();
    virtual int_type uflow();
    virtual int_type pbackfail(int_type c = traits::eof());
    virtual int_type overflow (int_type c = traits::eof());
    virtual basic_streambuf<charT,traits>* setbuf(char_type* s, streamsize n);
    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
                             ios_base::openmode which = ios_base::in|ios_base::out);
    virtual pos_type seekpos(pos_type sp,
                             ios_base::openmode which = ios_base::in|ios_base::out);
    virtual int sync();
    virtual void imbue(const locale& loc);
};

[編集] クラス std::basic_ifstream

template <class charT, class traits = char_traits<charT> >
class basic_ifstream : public basic_istream<charT,traits> {
 public:
    typedef charT char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits traits_type;
 
    // Constructors:
    basic_ifstream();
    explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
    explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in);
    basic_ifstream(const basic_ifstream& rhs) = delete;
    basic_ifstream(basic_ifstream&& rhs);
 
    // Assign/swap:
    basic_ifstream& operator=(const basic_ifstream& rhs) = 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(const char* s, ios_base::openmode mode = ios_base::in);
    void open(const string& s, ios_base::openmode mode = ios_base::in);
    void close();
 
 private:
    basic_filebuf<charT,traits> sb; // exposition only
};

[編集] クラス std::basic_ofstream

template <class charT, class traits = char_traits<charT> >
class basic_ofstream : public basic_ostream<charT,traits> {
 public:
    typedef charT char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits traits_type;
 
    // Constructors:
    basic_ofstream();
    explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
    explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out);
    basic_ofstream(const basic_ofstream& rhs) = delete;
    basic_ofstream(basic_ofstream&& rhs);
 
    // Assign/swap:
    basic_ofstream& operator=(const basic_ofstream& rhs) = 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(const char* s, ios_base::openmode mode = ios_base::out);
    void open(const string& s, ios_base::openmode mode = ios_base::out);
    void close();
 
 private:
    basic_filebuf<charT,traits> sb; // exposition only
};

[編集] クラス std::basic_fstream

template <class charT, class traits=char_traits<charT> >
class basic_fstream : public basic_iostream<charT,traits> {
 public:
    typedef charT char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits traits_type;
 
    // constructors/destructor
    basic_fstream();
    explicit basic_fstream(const char* s,
                           ios_base::openmode mode = ios_base::in|ios_base::out);
    explicit basic_fstream(const string& s,
                           ios_base::openmode mode = ios_base::in|ios_base::out);
    basic_fstream(const basic_fstream& rhs) = delete;
    basic_fstream(basic_fstream&& rhs);
 
    // Assign/swap:
    basic_fstream& operator=(const basic_fstream& rhs) = 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(const char* s,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    void open(const string& s,
              ios_base::openmode mode = ios_base::in|ios_base::out);
    void close();
 
 private:
    basic_filebuf<charT,traits> sb; // exposition only
};