fdstream.hpp: Classes for File Fescriptors and File Handles

[intro] [interface] [discussion] [code]

These are classes for low-level I/O with file descriptors and file handles, which I (Nicolai Josuttis) partially introduced in my book The C++ Standard Library - A Tutorial and Reference.

The classes are:

- fdoutbuf: an output stream buffer that write to a file descriptor
- fdostream: an output file stream that uses an fdoutbuf
- fdinbuf: an input stream buffer that reads from a file descriptor
- fdistream: an input file stream that uses an fdinbuf

The class provides the following interface:

> under construction

Some issues are open:

- integrating BUFSIZ
- optimizing of reading multiple characters
- streams for reading AND writing
- i18n
- tests against many many operating systems
- ...

I'd appreciate any constructive feedback. Please note: I don't have time to read all boost mails. Thus, to make sure that feedback arrives me, please send me a copy of each mail regarding this class.

The code is provided "as is" without expressed or implied warranty.

fdstream.hpp, the implementation of all classes:

- as HTML file
- as plain file

fdstest1.cpp, a simple example using file descriptors 0 (standard input) and 1 (standard output):

- as HTML file
- as plain file

fdstest2.cpp, another example using file descriptors opened with open():

- as HTML file
- as plain file

fdstest3.cpp, another example starting a pipe with popen():

- as HTML file
- as plain file

All files

- as ZIP file (16KB)
- as TGZ file (10KB)
  To find more details about using our own streams and stream buffers in C++, see e.g.
  The C++ Standard Library - A Tutorial and Reference
  by Nicolai M. Josuttis
  Addison Wesley Longman, 1999
  ISBN 0-201-37926-0

Home Page of Nicolai Josuttis

[intro] [interface] [discussion] [code]