VMS Help
CXXL, iostream_package

 *Conan The Librarian

  Classes in the iostream package provide methods to handle input and
  output streams, including the reading and writing of built-in data
  types. You can also extend certain methods described here to handle
  class types.

  This package includes, among others, the ios and streambuf classes,
  and the subclasses derived from these base classes.

  The istream (input stream) class supports input
  operations(extractions); the ostream (output stream) class supports
  output operations (insertions). The iostream class derives from both
  istream and ostream, and supports both extractions and insertions.

  The following stream objects are predefined:

  cin	An istream_withassign object linked to standard input

  cout	An istream_withassign object linked to standard output

  cerr	An ostream_withassign object linked to standard error that
 	supports unbuffered output

  clog	An ostream_withassign object linked to standard error that
 	supports buffered output

  To generate output, you apply the insertion operator (<<) to cout.
  For example:

 	cout << "Hello\n";

  Providing input is similar to generating output except that you apply
  the extraction operator (>>) to cin. For example:

 	int eye, jay;
 	cin >> eye >> jay;

  If you include these fragments of code in a program, your system
  expects users to type in two integer values (for eye and jay) from a
  terminal. The iostream package supplies predefined extraction and
  insertion operators for all built-in data types, including char*.

  The iostream package also supports file manipulation. To connect a
  specific file to your program, instantiate one of the following class
  types:

  ifstream	For file input
  ofstream	For file output
  fstream	For both input and output

  To format within character arrays, the iostream package includes the
  following associated class types:

  istrstream	For fetching characters from an array
  ostrstream	For storing characters into an array
  strstream	For both fetching and storing characters into an
 		array

  1 - Parameterized manipulators

  Each of these manipulators takes a single argument, operates on it
  as described, and returns it.

 1.1 - lock(Mutex &)

  Locks a recursive mutex

 1.2 - resetiosflags(long)

  Clears, in the stream  (istream or ostream), the format bits
  denoted by the argument.

 1.3 - setfill(int)

  Sets the fill character (istream or ostream) to be the value
  specified by the argument.

 1.4 - setiosflags(long)

  Turns on, in the stream  (istream or ostream), the format bits
  denoted by the argument.

 1.5 - setprecision(int)

  Sets the precision (istream or ostream) to be the value specified
  by the argument.

 1.6 - setw(int w)

  Sets the field width of the stream (left-hand operand: ostream
  or istream) to the value specified by the argument.

 1.7 - unlock(Mutex &)

  unlocks a recursive mutex

  2 - filebuf

  This class specializes the streambuf class to use a file as a
  repository of characters. Writing to the file consumes characters;
  reading from the file produces characters. Files that allow searches
  are said to be seekable. When a file is readable and writable, the
  filebuf object permits character insertion and extraction.

  Header:

 	#include <fstream.hxx>

  3 - fstream

  This class specializes the class iostream to files using a filebuf
  object to do the input and output. Your program can perform common
  operations, such as opening and closing files, without explicitly
  mentioning filebuf objects.

  Header:

 	#include <fstream.hxx>

  4 - ifstream

  This class specializes the class istream to files using a filebuf
  object to do the input. Your program can perform common operations,
  such as opening and closing files, without explicitly mentioning
  filebuf objects.

  Header:

 	#include <fstream.hxx>

  5 - ios

  Classes derived from the ios class provide an interface for
  transferring formatted and unformatted information into and out of
  streambuf objects.

  Header:

 	#include <iostream.hxx>

 5.1 - Deriving a user class

  If you derive your own class from the ios class, or from one of
  its derived classes, the ios sub-object must be properly initialized
  during instantiation.  Specifically, you must ensure that the
  streambuf pointer within the ios sub-object is valid. To do this, you
  can specify the ios(streambuf *) constructor as a member initializer
  for your class constructor.  Optionally, you can call the
  ios::init(streambuf *) member function.

  6 - iostream

  This class combines the classes istream and ostream. You use it to
  carry out bidirectional operations (inserting into and extracting from
  a single sequence of characters).

  Header:

 	#include <iostream.hxx>

  7 - iostream_withassign

  This class adds an assignment operator and a constructor with no
  operands to the iostream class.

  Header:

 	#include <iostream.hxx>

  8 - istream

  This class provides facilities for formatted and unformatted
  extraction from streambuf objects.

  Header:

 	#include <iostream.hxx>

  9 - istream_withassign

  This class adds an assignment operator and a constructor with no
  operands to the istream class.

  Header:

 	#include <iostream.hxx>

  10 - istrstream

  This class specializes the istream class to perform extractions from
  arrays of bytes in memory.

  Header:

 	#include <strstream.hxx>

  11 - ofstream

  This class specializes the class ostream to files using a filebuf
  object to do the output. Your program can perform common operations,
  such as opening and closing files, without explicitly mentioning
  filebuf objects.

  Header:

 	#include <fstream.hxx>

  12 - ostream

  Objects of this class perform formatted and unformatted insertions
  into streambuf objects.

  Header:

 	#include <iostream.hxx>

  13 - ostream_withassign

  This class adds an assignment operator and a constructor with no
  operands to the ostream class.

  Header:

 	#include <iostream.hxx>

  14 - ostrstream

  This class specializes the ostream class to perform insertions into
  arrays of bytes in memory.

  Header:

 	#include <strstream.hxx>

  15 - stdiobuf

  This class specializes the streambuf class for stdio FILEs. It uses
  unbuffered mode, which causes all operations to be reflected immediately
  in the FILE.

  Header:

 	#include <stdiostream.hxx>

  16 - stdiostream

  This class specializes the ios class for stdio FILEs; it also
  specializes the ios class to use stdiobuf as its associated streambuf.

  Header:

 	#include <stdiostream.hxx>

  17 - streambuf

  This class supports buffers into which you can insert (put) or extract
  (get) characters. It contains only the basic members for manipulating
  the characters. To implement the functions of this class, use a
  class derived from the streambuf class.

  The protected members of this class present an interface to the
  derived classes organized around the get, put, and reserve areas
  (arrays of bytes), which are managed cooperatively by the base and
  derived classes.

  The reserve area is a sequence of characters with an associated get
  pointer, put pointer, or both. This area serves mainly as a resource
  in which to allocate space for the put and get areas.  As characters
  enter and exit the reserve area, the put and get areas change but the
  reserve area remains fixed. A collection of character pointer values
  defines the three areas. These pointers infer a boundary condition;
  therefore, it may be helpful to consider such pointers as pointing
  just before the byte but they actually point right at it.

  Classes derived from streambuf vary in their handling of the get and
  put pointers. The simplest are unidirectional buffers that permit only
  get and put operations. Such classes serve as producers and consumers
  of characters. Queue-like buffers (such as strstream and strstreambuf)
  have a put and a get pointer that move independently of each other. In
  such buffers, stored characters are queued until later fetched.
  File-like buffers (such as filebuf) allow both get and put operations
  but have their get and put pointers linked together, so that when one
  pointer moves so does the other.

  To manage the collections of characters in the get and put areas, you
  can call virtual functions. Services supplied by virtual functions
  include fetching more characters from an ultimate producer and
  flushing a collection of characters to an ultimate consumer.

  Header:

 	#include <iostream.hxx>

  18 - strstream

  This class specializes iostream for storing in and fetching from
  arrays of bytes. It handles all predefined data types, and provides an
  extensive set of options for performing input and output on these data
  types.

  Header:

 	#include <strstream.hxx>

  19 - strstreambuf

  Objects of this class let you use an array of bytes (a string of
  characters) in memory as a streambuf for stream input/output
  operations on various kinds of data. Mapping between abstract get and
  put pointers and char* pointers is direct in the sense that a char* is
  interpreted as pointing immediately ahead of the char it points to.
  Moving the pointers corresponds to incrementing and decrementing the
  char* values.

  To accommodate the need for strings of arbitrary length, this class
  supports a dynamic mode. When a strstreambuf object is in dynamic
  mode, space for the character is allocated as needed. When the
  sequence is extended too far, it is copied to a new array.

  Header:

 	#include <strstream.hxx>

  20 - Manipulators

  Manipulators are supplied to let executing programs insert values into or
  extract values from a stream to cause some special effect as follows:

  ios &dec(ios &s)	     Sets the conversion base format to decimal.
  ios &hex(ios &s)	     Sets the conversion base format to hexadecimal.
  ios &oct(ios &s)	     Sets the conversion base format to octal.
  ios &lock(ios &s)           Locks a predefined object
  ios &unlock(ios &s)         Unlcks a predefined object
  istream &ws(istream &i)     Extracts (skips) white-space characters.
  ostream &endl(ostream &o)   Ends a line by inserting a new-line character and
 				flushing.
  ostream &ends(ostream &o)   Ends a string by inserting a null (0) character.
  ostream &flush(ostream &o)  Flushes ostreams.

  21 - IMANIP(TYPE)

  This class supplies predefined parameterized manipulators and provides
  macros for user-defined parameterized manipulators for istream
  objects.

  Header:

 	#include <iomanip.hxx>

  22 - IOMANIP(TYPE)

  This class supplies predefined parameterized manipulators and provides
  macros for user-defined parameterized manipulators for iostream
  objects.

  Header:

 	#include <iomanip.hxx>

  23 - OMANIP(TYPE)

  This class supplies predefined parameterized manipulators and provides
  macros for user-defined parameterized manipulators for ostream
  objects.

  Header:

 	#include <iomanip.hxx>

  24 - SMANIP(TYPE)

  This class supplies predefined parameterized manipulators and provides
  macros for user-defined parameterized manipulators for ios objects.

  Header:

 	#include <iomanip.hxx>

  25 - Predefined stream objects synchronization

  Two unparameterized locking and unlocking manipulators, lock and unlock,
  are available for use in synchronizing access to the predefined stream
  objects: cerr, cin, clog, and cout. If your application needs to lock
  two or more of these objects at the same time, the application must
  adhere to this locking order:

     cin, cerr, clog, cout

  The unlocking order is not important.

  When your application calls a member function for a predefined stream
  object, the member function will typically lock the object for the
  duration of the call.  Therefore, if your application has locked one of
  the stream objects and then uses another, this use must also adhere to
  the predefined locking order.  For example, your application should not
  send output to cerr while cout is locked.

  The locking order necessarily matches the default 'ties' between the
  stream objects as follows:

  cin is tied to cout
  cerr  is tied to cout
  clog is tied to cout
  cout has no ties

  Any input/output operation on a stream object causes the iostream
  Package to flush the object to which it is tied. Thus, an output to
  cerr flushes cout.

  26 - User-defined stream objects synchronization

   Two parameterized locking and unlocking manipulators, lock and unlock,
   are available for use in synchronizing access to user-defined stream
   objects.  To use these manipulators, you must first define a Mutex
   object which you then pass to the manipulator.  The association
   of a Mutex object with a stream object is not enforced by the iostream
   package. This association is enforced only by a program developer.
   For more information, see help on the Mutex_package.
  Close     Help