filebuf
mutable filebuf __my_fb; // mutable so rdbuf() can be const
filebuf* rdbuf() const { return &__my_fb; }
filebuf* rdbuf() const { return (filebuf*) ios::rdbuf(); }
class procbuf : public filebuf {
procbuf() : filebuf() { }
procbuf *close() { return (procbuf*)filebuf::close(); }
class stdiobuf : public filebuf {
class filebuf : public streambuf {
filebuf();
filebuf(int fd);
filebuf(int fd, char* p, int len);
static filebuf *__new();
~filebuf();
filebuf* attach(int fd);
filebuf* open(const char *filename, const char *mode);
filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
filebuf* close();
filebuf* filebuf::open(const char *filename, const char *mode)
return (filebuf*)_IO_file_fopen(this, filename, mode, 0);
return (filebuf*)_IO_file_fopen(this, filename, mode);
filebuf* filebuf::attach(int fd)
return (filebuf*)_IO_file_attach(this, fd);
streambuf* filebuf::setbuf(char* p, int len)
int filebuf::doallocate() { return _IO_file_doallocate(this); }
int filebuf::overflow(int c)
int filebuf::underflow()
int filebuf::sync()
streampos filebuf::seekoff(streamoff offset, _seek_dir dir, int mode)
filebuf* filebuf::close()
return (_IO_file_close_it(this) ? (filebuf*)NULL : this);
streamsize filebuf::sys_read(char* buf, streamsize size)
streampos filebuf::sys_seek(streamoff offset, _seek_dir dir)
streamsize filebuf::sys_write(const char *buf, streamsize n)
int filebuf::sys_stat(void* st)
int filebuf::sys_close()
streamsize filebuf::xsputn(const char *s, streamsize n)
streamsize filebuf::xsgetn(char *s, streamsize n)
const int filebuf::openprot = 0644;
void filebuf::init()
filebuf::filebuf()
filebuf* filebuf::__new()
filebuf *fb = new filebuf;
filebuf::filebuf(int fd)
filebuf::filebuf(int fd, char* p, int len)
filebuf::~filebuf()
filebuf* filebuf::open(const char *filename, ios::openmode mode, int prot)
init(filebuf::__new());
init(filebuf::__new());
((struct filebuf*)rdbuf())->close();
init(new filebuf());
init(new filebuf());
procbuf::procbuf(const char *command, int mode) : filebuf()
if (filebuf::overflow(c) == EOF)
stdiobuf::stdiobuf(FILE *f) : filebuf(fileno(f))
#define filebuf_vtable _G_VTABLE_LABEL_PREFIX_ID##filebuf