Share via


basic_filebuf

basic_filebuf

template <class E, class T = char_traits<E> >
    class basic_filebuf : public basic_streambuf<E, T> {
public:
    basic_filebuf();
    bool is_open() const;
    basic_filebuf *open(const char *s, ios_base::openmode mode);
    basic_filebuf *close();
protected:
    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 pos,
        ios_base::openmode which = ios_base::in | ios_base::out);
    virtual int_type underflow();
    virtual int_type pbackfail(int_type c = T::eof());
    virtual int_type overflow(int_type c = T::eof());
    virtual int sync();
    virtual basic_streambuf<E, T> *setbuf(E *s, streamsize n);
    };

The template class describes a stream buffer that controls the transmission of elements to and from a sequence of elements stored in an external file.

An object of class basic_filebuf<E, T> stores a file pointer, which designates the FILE object that controls the stream associated with an open file. It also stores pointers to two file conversion facets for use by the protected member functions overflow and underflow.