.\" to invoke 'tbl', 'eqn', 'pic' in the proper order .\" '\" tep .\" .\" @(#)stdiobuf.3 1.5 00/02/18 SMI; .\" .TH STDIOBUF 3CC4 "14 March 1995" .\" .SH NAME stdiobuf \- buffer and stream classes for use with C stdio .SH SYNOPSIS .LP .nf .ft B #include \fI// includes and \fB .sp .5v class stdiobuf : public streambuf { public: stdiobuf(FILE*); FILE* stdiofile(); }; .sp .5v class stdiostream : public ios { public: stdiostream(FILE*); stdiobuf* rdbuf(); }; .ft R .fi .\" .SH DESCRIPTION .LP The \fBstdiobuf\fR class is a specialization of \fBstreambuf\fRs using a C stdio FILE as an intermediary to an actual file which is the source or destination of characters. The basic \fBstreambuf\fR operations are as described in .BR sbufprot "(3CC4) and" .BR sbufpub (3CC4). Input, output, and seek operations are reflected in changes to the associated FILE. The seek functions are implemented in terms of \fBfseek()\fR, for example. .LP The \fBstdiostream\fR provides a C++ interface to a C stdio FILE. It has a \fBstdiobuf\fR as its buffer. It is not a full implementation of iostreams; it has only the buffer-class and \fBios\fR-class functionality. C++ I/O is done via per-character calls to the C stdio \fBgetc()\fR and \fBputc()\fR functions. There is no normal buffering, since that would break synchronization of the C and C++ accesses. .LP The only reason to use either of these classes is to provide a way to mix C stdio code and C++ iostream-like code on the same file. Prefer to use \fBfilebuf\fR and \fBfstream\fR, which are far more efficient, for new code. .\" .SS "stdiobuf functions" .TP .B "stdiobuf(fp)" Constructs a \fBstdiobuf\fR attached to the FILE structure pointed to by \fBfp\fR. .TP .B "FILE* fp = siobuf.stdiofile()" Returns a pointer to the FILE structure associated with \fBsiobuf\fR. .\" .SS "stdiostream functions" .TP .B "stdiostream(fp)" Constructs a \fBstdiostream\fR attached to the FILE structure pointed to by \fBfp\fR. .TP .B "stdiobuf* sbp = siostr.rdbuf()" Returns a pointer to the \fBstdiobuf\fR associated with \fBsiostr\fR. This is the same as \fBios::rdbuf()\fR, except that the return type is specifically a \fBstdiobuf\fR. .\" .SH "SEE ALSO" .LP .na .BR ios.intro (3CC4), .BR ios (3CC4), .BR sbufprot (3CC4), .BR sbufpub (3CC4), .BR stdio (3V), .TP .I C++ Library Reference .TP Chapter 3, "The Classic \fIiostream\fR Library", .\" .TZ ????