2011. 3. 14. 20:24

출처:http://www.cplusplus.com/reference/iostream/istream/

Output Stream

ostream

ostream objects are stream objects used to write and format output as sequences of characters. Specific members are provided to perform these output operations, which can be divided in two main groups:
  • Formatted output
    These member functions interpret and format the data to be written as sequences of characters. These type of operation is performed using member and global functions that overload the insertion operator (operator<<).
  • Unformatted output
    Most of the other member functions of the ostream class are used to perform unformatted output operations, i.e. output operations that write the data as it is, with no formatting adaptations. These member functions can write a determined number of characters to the output character sequence (put, write) and manipulate the put pointer (seekp, tellp).
Additionaly, a member function exists to synchronize the stream with the associated external destination of characters: sync.

The standard objects cout, cerr and clog are instantiations of this class.

The class inherits all the internal fields from its parent classes ios_base and ios:

Formatting information
  • format flags: a set of internal indicators describing how certain input/output operations shall be interpreted or generated. The state of these indicators can be obtained or modified by calling the members flags, setf and unsetf, or by using manipulators.
  • field width: describes the width of the next element to be output. This value can be obtained/modified by calling the member function width or parameterized manipulator setw.
  • display precision: describes the decimal precision to be used to output floating-point values. This value can be obtained/modified by calling member precision or parameterized manipulator setprecision.
  • fill character: character used to pad a field up to the field width. It can be obtained or modified by calling member function fill or parameterized manipulator setfill.
  • locale object: describes the localization properties to be considered when formatting i/o operations. The locale object used can be obtained calling member getloc and modified using member imbue.
State information
  • error state: internal indicator reflecting the integrity and current error state of the stream. The current object may be obtained by calling rdstate and can be modified by calling clear and setstate. Individual values may be obtained by calling good, eof, fail and bad.
  • exception mask: internal exception status indicator. Its value can be retrieved/modified by calling member exceptions.
Other
  • event function stack: stack of pointers to callback functions that are called when certain events occur. Additional callback functions may be registered to be called when an event occurs, using member function register_callback.
  • internal extensible arrays: two internal arrays to store long objects and void pointers. These arrays can be extended by calling member function xalloc, and references to these objects can be retrieved with iword or pword.
  • pointer to tied stream: pointer to the stream object which is tied to this stream object. It can be obtained/modified by calling member function tie.
  • pointer to stream buffer: pointer to the associated streambuf object. It can be obtained/modified by calling member function rdbuf.

Public members


Formatted output:

Unformatted output:

Positioning:

Synchronization:

Prefix/Suffix:

Member functions inherited from ios


Member functions inherited from ios_base




istream

class
<istream>

Input stream

istream


istream objects are stream objects used to read and interpret input from sequences of characters. Specific members are provided to perform these input operations, which can be divided in two main groups:
  • Formatted input
    These functions extract data from a sequence of characters that may be interpreted and formatted to a value of a certain type. These type of operation is performed using member and global functions that overload the extraction operator ().
  • Unformatted input
    Most of the other member functions of the istream class are used to perform unformatted input, i.e. no interpretation is made on the characters got form the input. These member functions can get a determined number of characters from the input character sequence (get, getline, peek, read, readsome), manipulate the get pointer i(ignore, seekg, tellg, unget) or get information of the last unformatted input operation (gcount).
Additionaly, a member function exists to synchronize the stream with the associated external source of characters: sync.

The standard object cin is an instantiation of this class.

The class inherits all the internal fields from its parent classes ios_base and ios:

Formatting information
  • format flags: a set of internal indicators describing how certain input/output operations shall be interpreted or generated. The state of these indicators can be obtained or modified by calling the members flags, setf and unsetf, or by using manipulators.
  • field width: describes the width of the next element to be output. This value can be obtained/modified by calling the member function width or parameterized manipulator setw.
  • display precision: describes the decimal precision to be used to output floating-point values. This value can be obtained/modified by calling member precision or parameterized manipulator setprecision.
  • fill character: character used to pad a field up to the field width. It can be obtained or modified by calling member function fill or parameterized manipulator setfill.
  • locale object: describes the localization properties to be considered when formatting i/o operations. The locale object used can be obtained calling member getloc and modified using member imbue.
State information
  • error state: internal indicator reflecting the integrity and current error state of the stream. The current object may be obtained by calling rdstate and can be modified by calling clear and setstate. Individual values may be obtained by calling good, eof, fail and bad.
  • exception mask: internal exception status indicator. Its value can be retrieved/modified by calling member exceptions.
Other
  • event function stack: stack of pointers to callback functions that are called when certain events occur. Additional callback functions may be registered to be called when an event occurs, using member function register_callback.
  • internal extensible arrays: two internal arrays to store long objects and void pointers. These arrays can be extended by calling member function xalloc, and references to these objects can be retrieved with iword or pword.
  • pointer to tied stream: pointer to the stream object which is tied to this stream object. It can be obtained/modified by calling member function tie.
  • pointer to stream buffer: pointer to the associated streambuf object. It can be obtained/modified by calling member function rdbuf.

Public members


Formatted input:

Unformatted input:

Positioning:

Synchronization:

Prefix/Suffix:

Member functions inherited from ios


Member functions inherited from ios_base

Posted by Triany