===========
  FSTREAM.H
 ===========
Declares the C++ stream classes that support
file input and output.

Replaces the older, now outdated STDIOSTR.H.

 Includes
 ========
  IOSTREAM.H  

 Classes
 =======
To get more Help on the classes in the
FSTREAM.H header file (and their attendant
member functions and data members), choose
one of these Help links:

  filebuf     
  fstream     
  fstreambase 
  ifstream    
  ofstream    

 See Also
 ========
  List of all header files
  Streamable Classes      


============ STDIOSTR.H ============ Declares the C++ (version 2.0) stream classes for use with stdio FILE structures. This file has been included for upward compatibility; use the standard classes and functions in FSTREAM.H instead. See Also ======== List of all Header files
========================================= filebuf class summary (FSTREAM.H) ========================================= Derived From: streambuf Base For: None Specializes streambuf to handle files. Filebuf implements input and output to and from files. Since streambuf does not provide streams for input or output, the derived classes of streambuf must do so. Class filebuf is one of the two classes defined in the C++ Stream Library that provide a place for input to be gathered from and a place for output to go. The I/O functions of classes istream and ostream make calls to the functions of filebuf to do the actual insertion or extraction on the streams. This occurs if the 'bp' (pointer to streambuf) data member of class ios has been assigned a pointer to class filebuf. Constructors and Destructor: filebuf::filebuf(); filebuf::filebuf(int fd); filebuf::filebuf(int fd, char *, int n); filebuf::~filebuf(); Member Functions: filebuf::attach filebuf::close filebuf::fd filebuf::~filebuf filebuf::filebuf filebuf::is_open filebuf::open filebuf::overflow filebuf::seekoff filebuf::setbuf filebuf::sync filebuf::underflow
filebuf::filebuf (constructors) ================================= Declarations: Form 1 filebuf(); Form 2 filebuf(int fd); Form 3 filebuf(int fd, char *, int n); See Also: filebuf
filebuf::filebuf (constructor) ================================ Declaration: filebuf(); Remarks: Makes a filebuf that isn't attached to a file. See Also: filebuf::filebuf, Form 2 filebuf::filebuf, Form 3 filebuf::filebuf File Handle
filebuf::filebuf (constructor) ================================ Declaration: filebuf(int fd); Remarks: Makes a filebuf attached to a file by file descriptor fd. See Also: filebuf::filebuf, Form 1 filebuf::filebuf, Form 3 filebuf::filebuf File Handle
filebuf::filebuf (constructor) ================================ Declaration: filebuf(int fd, char *, int n); Remarks: Makes a filebuf attached to a file and uses a specified n-character buffer. See Also: filebuf::filebuf, Form 1 filebuf::filebuf, Form 2 filebuf::filebuf File Handle
filebuf::~filebuf (destructor) ================================ Declaration: ~filebuf(); Remarks: The file associated with the stream is closed if it is owned by the class. If the file does not belong to the class, the destructor will flush all the output from the put area of the internal buffer to the output file. See Also: filebuf File Handle
filebuf::attach (member function) =================================== Declaration: filebuf* attach(int); Remarks: Attaches this closed filebuf to opened file descriptor. See Also: filebuf
filebuf::close (member function) ================================== Declaration: filebuf* close(); Remarks: Flushes and closes the file. Returns 0 on error. See Also: filebuf
filebuf::fd (member function) =============================== Declaration: int fd(); Remarks: Returns the file descriptor or EOF. See Also: filebuf
filebuf::is_open (member function) ==================================== Declaration: int is_open(); Remarks: Returns nonzero if the file is open. See Also: filebuf
filebuf::open (member function) ================================= Declaration: filebuf* open(const char*, int mode, int prot = filebuf::openprot); Remarks: Opens the given file and connects to it. If there is no file attached to the filebuf, the file will be opened in the mode and attached to the filebuf. See File Open for description of the parameters. See Also: filebuf
filebuf::overflow =================== Declaration: virtual int overflow(int = EOF); Remarks: Flushes a buffer to its destination. Every derived class should define the actions to be taken. See Also: filebuf
filebuf::seekoff (member function) ==================================== Declaration: virtual streampos seekoff(streamoff, ios::seek_dir, int); Remarks: Moves the file pointer relative to the current position. seek_dir is set using the seek_dir enumeration definition in class ios. ----------+----------------------------- ios::beg | Seek from beginning of file ios::cur | Seek from current location ios::end | Seek from end of file Since the long can be a negative value, seeking can occur "backwards" in the file from the end or current location. See Also: filebuf
filebuf::setbuf (member function) =================================== Declaration: virtual streambuf* setbuf(char*, int); Remarks: Specifies a buffer for this filebuf. See Also: filebuf
filebuf::sync (member function) ================================= Declaration: virtual int sync() Remarks: Establishes consistency between internal data structures and the external stream representation. See Also: filebuf
filebuf::underflow (member function) ====================================== Declaration: virtual int underflow() Remarks: Makes input available. This is called when no more data exists in the input buffer. Every derived class should define the actions to be taken. See Also: filebuf
============================================= fstreambase class summary (FSTREAM.H) ============================================= Derived From: ios Base For: fstream, ifstream, ofstream Remarks: fstreambase provides access to the functions of filebuf that are not accessible in fstreambase (and its derived classes) through bp. +-----+ +--------------------------+ | ios |--------->| streambuf *bp = filebuf* | +--=--+ | (ie: &fstreambase::buf) | | +--------------------------+ +-----+-----+ |fstreambase| +-----------+ bp is the pointer to streambuf data member of class ios. If a member function of filebuf is not a virtual member of filebuf's base class (streambuf), it is not accessible. For example, attach, open and close are not accessible. fstreambase provides this accessibility through its private filebuf data member 'buf'. The constructors of fstreambase initialize the ios::bp data member to point to the filebuf::buf. Constructors: fstreambase::fstreambase() fstreambase::fstreambase(const char*, int, int = filebuf::openprot) fstreambase::fstreambase(int) fstreambase::fstreambase(int _f, char*, int) Member Functions: fstreambase::attach fstreambase::close fstreambase::fstreambase fstreambase::open fstreambase::rdbuf fstreambase::setbuf
fstreambase::fstreambase (constructors) ========================================= Declarations: Form 1 fstreambase(); Form 2 fstreambase(const char*, int, int = filebuf::openprot); Form 3 fstreambase(int); Form 4 fstreambase(int _f, char*, int); See Also: fstreambase
fstreambase::fstreambase (constructor, Form 1) ================================================ Declaration: fstreambase(); Remarks: Makes an fstreambase that isn't attached to a file. See Also: fstreambase constructor, Form 2 fstreambase constructor, Form 3 fstreambase constructor, Form 4 fstreambase::fstreambase
fstreambase::fstreambase (constructor, Form 2) ================================================ Declaration: fstreambase(const char*, int, int = filebuf::openprot); Remarks: Makes an fstreambase, opens a file, and connects to it. See Also: fstreambase constructor, Form 1 fstreambase constructor, Form 3 fstreambase constructor, Form 4 fstreambase::fstreambase File Open
fstreambase::fstreambase (constructor, Form 3) ================================================ Declaration: fstreambase(int); Remarks: Makes an fstreambase, connects to an open file descriptor. See Also: fstreambase constructor, Form 1 fstreambase constructor, Form 2 fstreambase constructor, Form 4 fstreambase::fstreambase
fstreambase::fstreambase (constructor, Form 4) ================================================ Declaration: fstreambase(int _f, char*, int); Remarks: Makes an fstreambase connected to an open file and uses a specified buffer. See Also: fstreambase constructor, Form 1 fstreambase constructor, Form 2 fstreambase constructor, Form 3 fstreambase::fstreambase File Handle
fstreambase::attach (member function) ======================================= Declaration: void attach(int); Remarks: Connects to an open file descriptor. See Also: fstreambase filebuf::attach
fstreambase::close (member function) ====================================== Declaration: void close(); Remarks: Closes the associated filebuf and file. See Also: fstreambase filebuf::close
fstreambase::open (member function) ===================================== Declaration: void open(const char*, int, int = filebuf::openprot); Remarks: Opens a file for an fstreambase. See Also: fstreambase filebuf::open
fstreambase::rdbuf (member function) ====================================== Declaration: filebuf* rdbuf(); Remarks: Returns the address of the private filebuf data member 'buf'. See Also: fstreambase
fstreambase::setbuf (member function) ======================================= Declaration: void setbuf(char*, int); Remarks: Assigns a user-specified buffer to the filebuf. See Also: fstreambase
========================================= fstream class summary (FSTREAM.H) ========================================= +---------+ +---------+ | ios |-------------------------------->|streambuf| +---=-=-=-+ +----=----+ | | +----------------------+ | +---+ +---+ | | +---+---+ +---+---+ | | |istream| |ostream| | | +-=-=---+ +---=-=-+ ==============|=================|====== | +---+ +---+ +------------------|--------+ | | +---+-+---+ +------+------+ | +----+----+ | |iostream | | fstreambase | | | filebuf | | +----=----+ +---=--=--=---+ | +---------+ +------|----------------+ +---+ | +---+ | | +---+-+----+ | +----+-+---+ | | ifstream | | | ofstream | | +-----=----+ | +----=-----+ | +----+ | +----+ +---------------------+ | | | +-+-+-+-+---+ | fstream | +-----------+ ======================================= Remarks: Provides for simultaneous input and output on a filebuf. Input and output is initiated using the functions of the base classes istream and ostream. For example, fstream can use the function istream::getline() to extract characters from the file. Constructors: fstream::fstream(); fstream::fstream(const char*, int, int = filebuf::openprot); fstream::fstream(int); fstream::fstream(int _f, char*, int); Member Functions: fstream::fstream fstream::open fstream::rdbuf
fstream::fstream constructors =============================== Declarations: Form 1: fstream(); Form 2: fstream(const char*, int, int = filebuf::openprot); Form 3: fstream(int); Form 4: fstream(int _f, char*, int); See Also: fstream
fstream::fstream constructor, Form 1 ====================================== Declaration: fstream(); Remarks: Makes an fstream that isn't attached to a file. See Also: fstream constructor, Form 2 fstream constructor, Form 3 fstream constructor, Form 4 fstream::fstream
fstream::fstream constructor, Form 2 ====================================== Declaration: fstream (const char*, int, int = filebuf::openprot); Remarks: Makes an fstream, opens a file, and connects to it. See Also: fstream constructor, Form 1 fstream constructor, Form 3 fstream constructor, Form 4 fstream::fstream File Open
fstream::fstream constructor, Form 3 ====================================== Declaration: fstream(int); Remarks: Makes an fstream, connects to an open file descriptor. See Also: fstream constructor, Form 1 fstream constructor, Form 2 fstream constructor, Form 4 fstream::fstream
fstream::fstream constructor, Form 4 ====================================== Declaration: fstream(int _f, char*, int); Remarks: Makes an fstream connected to an open file and uses a specified buffer. See Also: fstream constructor, Form 1 fstream constructor, Form 2 fstream constructor, Form 3 fstream::fstream File Handle
fstream::open (member function) ================================= Declaration: void open(const char*, int, int = filebuf::openprot); Remarks: Opens a file for an fstream. See Also: fstream File Open
fstream::rdbuf (member function) ================================== Declaration: filebuf* rdbuf(); Remarks: Returns the buffer used. See Also: fstream File Rdbuf
File Open =========== Member functions and constructors of the form (const char*, int mode, int prot = filebuf::openprot) are used to open a file. The mode parameter can be set using the values in the open_mode enumeration defined in class ios. For example, the mode parameter could be ios::binary|ios::in|ios::out. The prot parameter corresponds to the access permission under DOS, and it is used unless ios::nocreate is specified in mode. The default parameter is set to read and write permission.
File Handle and New Buffer ============================ Member functions and constructors of the form (int _f, char*, int n) are used to attach the filehandle _f to the filebuf, and use the specified n-character array as the internal buffer.
file rdbuf ============ Member functions of the form filebuf *rdbuf(); return the address of private filebuf data member 'buf' of base class fstreambase.
======================================== ifstream class summary (FSTREAM.H) ======================================== Derived From: fstreambase, istream Base For: None Remarks: Provides an input stream to input from a file using a filebuf. +-----+ +--------------------------+ | ios |--------->| streambuf *bp = filebuf* | +-=-=-+ | (ie: &fstreambase::buf) | +----+ +----+ +--------------------------+ +---+---+ +-----+-----+ |istream| |fstreambase| +---=---+ +-----=-----+ +----+ +----+ +---+-+---+ |ifstream | +---------+ Constructors: ifstream::ifstream(); ifstream::ifstream(const char*, int, int = filebuf::openprot); ifstream::ifstream(int); ifstream::ifstream(int fd, char*, int); Member Functions: ifstream::ifstream ifstream::open ifstream::rdbuf
ifstream::ifstream (constructors) =================================== Declarations: Form 1 ifstream() ; Form 2 ifstream(const char*, int, int = filebuf::openprot); Form 3 ifstream(int); Form 4 ifstream(int fd, char*, int); See Also: ifstream
ifstream::ifstream (constructor, Form 1) ========================================== Declaration: ifstream(); Remarks: Makes an ifstream that isn't attached to a file. See Also: ifstream constructor, Form 2 ifstream constructor, Form 3 ifstream constructor, Form 4 ifstream::ifstream
ifstream::ifstream (constructor, Form 2) ========================================== Declaration: ifstream(const char*, int = in, int = filebuf::openprot); Remarks: Makes an ifstream, opens an input file in protected mode, and connects to it. The existing file contents are preserved; new writes are appended. See Also: ifstream constructor, Form 1 ifstream constructor, Form 3 ifstream constructor, Form 4 ifstream::ifstream File Open
ifstream::ifstream (constructor, Form 3) ========================================== Declaration: ifstream(int); Remarks: Makes an ifstream, connects to an open file descriptor. See Also: ifstream constructor, Form 1 ifstream constructor, Form 2 ifstream constructor, Form 4 ifstream::ifstream
ifstream::ifstream (constructor, Form 4) ========================================== Declaration: ifstream(int fd, char*, int); Remarks: Makes an ifstream connected to an open file and uses a specified buffer. See Also: ifstream constructor, Form 1 ifstream constructor, Form 2 ifstream constructor, Form 3 ifstream::ifstream File Handle
ifstream::open (member functions) =================================== Declaration: void open(const char*, int, int = filebuf::openprot); Remarks: Open a file for an ifstream. See Also: ifstream File Open
ifstream::rdbuf (member functions) ==================================== Declaration: filebuf* rdbuf(); Remarks: Return the buffer used. See Also: ifstream File Rdbuf
========================================== ofstream class summary (FSTREAM.H) ========================================== Derived From: fstreambase, ostream Base For: None Remarks: Provides an output stream to extract from a file using a filebuf. +-----+ +--------------------------+ | ios |--------->| streambuf *bp = filebuf* | +-=-=-+ | (ie: &fstreambase::buf) | +----+ +----+ +--------------------------+ +---+---+ +-----+-----+ |ostream| |fstreambase| +---=---+ +-----=-----+ +----+ +----+ +---+-+---+ |ofstream | +---------+ Constructors: ofstream::ofstream(); ofstream::ofstream(const char*, int=ios::out, int = filebuf::openprot); ofstream::ofstream(int); ofstream::ofstream(int fd, char*, int); Member Functions: ofstream::ofstream ofstream::open ofstream::rdbuf
ofstream::ofstream (constructors) ================================== Declarations: Form 1 ofstream(); Form 2 ofstream(const char*, int=ios::out, int = filebuf::openprot); Form 3 ofstream(int); Form 4 ofstream(int fd, char*, int); See Also ofstream
ofstream::ofstream, Form 1 (constructor) ========================================== Declaration: ofstream(); Remarks: Makes an ofstream that isn't attached to a file. See Also: ofstream::ofstream ofstream::ofstream, Form 2 ofstream::ofstream, Form 3 ofstream::ofstream, Form 4
ofstream::ofstream, Form 2 (constructor) ========================================== Declaration: ofstream(const char*, int=ios::out, int = filebuf::openprot); Remarks: Makes an ofstream, opens a file for writing, and connects to it. See Also ofstream::ofstream ofstream::ofstream, Form 1 ofstream::ofstream, Form 3 ofstream::ofstream, Form 4 file open
ofstream::ofstream, Form 3 (constructor) ========================================== Declaration: ofstream(int); Remarks: Makes an ofstream, connects to an open file descriptor. See Also: ofstream::ofstream ofstream::ofstream, Form 1 ofstream::ofstream, Form 2 ofstream::ofstream, Form 4
ofstream::ofstream, Form 4 (constructor) ========================================== Declaration: ofstream(int fd, char*, int); Remarks: Makes an ofstream connected to an open file and uses a specified buffer. See Also: ofstream::ofstream ofstream::ofstream, Form 1 ofstream::ofstream, Form 2 ofstream::ofstream, Form 3 file handle
ofstream::open (member function) ================================== Declaration: void open(const char*, int, int = filebuf::openprot); Remarks: Opens a file for an ofstream. ios::out has been binarily included (ORed) into the mode (second parameter) by default to ensure the file is opened for writing. See Also ofstream file open
ofstream::rdbuf (member function) =================================== Declaration: filebuf* rdbuf(); Remarks: Returns the buffer used. See Also ofstream file rdbuf