home *** CD-ROM | disk | FTP | other *** search
Wrap
IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) NNNNAAAAMMMMEEEE iostream - buffering, formatting and input/output SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>> _cccc_llll_aaaa_ssss_ssss _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_oooo_ssss _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_oooo_ssss _;;;; _cccc_llll_aaaa_ssss_ssss _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_oooo_ssss _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm_,,,, _pppp_uuuu_bbbb_llll_iiii_cccc _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _IIII_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______iiii_nnnn_iiii_tttt _;;;; _eeee_xxxx_tttt_eeee_rrrr_nnnn _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _cccc_iiii_nnnn _;;;; _eeee_xxxx_tttt_eeee_rrrr_nnnn _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _cccc_oooo_uuuu_tttt _;;;; _eeee_xxxx_tttt_eeee_rrrr_nnnn _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _cccc_eeee_rrrr_rrrr _;;;; _eeee_xxxx_tttt_eeee_rrrr_nnnn _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _cccc_llll_oooo_gggg _;;;; _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>> _cccc_llll_aaaa_ssss_ssss _ffff_iiii_llll_eeee_bbbb_uuuu_ffff _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff _;;;; _cccc_llll_aaaa_ssss_ssss _ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _oooo_ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>> _cccc_llll_aaaa_ssss_ssss _ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff _;;;; _cccc_llll_aaaa_ssss_ssss _iiii_ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _cccc_llll_aaaa_ssss_ssss _oooo_ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _;;;; _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_tttt_dddd_iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>> _cccc_llll_aaaa_ssss_ssss _ssss_tttt_dddd_iiii_oooo_bbbb_uuuu_ffff _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff _;;;; _cccc_llll_aaaa_ssss_ssss _ssss_tttt_dddd_iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm _:::: _pppp_uuuu_bbbb_llll_iiii_cccc _iiii_oooo_ssss _;;;; DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN The C++ iostream package declared in _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh and other header files consists primarily of a collection of classes. Although originally intended only to support input/output, the package now supports related activities such as incore formatting. This package is a mostly source- compatible extension of the earlier stream I/O package, described in _T_h_e _C++ _P_r_o_g_r_a_m_m_i_n_g _L_a_n_g_u_a_g_e by Bjarne Stroustrup. In the iostream man pages, _c_h_a_r_a_c_t_e_r refers to a value that can be held in either a _cccc_hhhh_aaaa_rrrr or _uuuu_nnnn_ssss_iiii_gggg_nnnn_eeee_dddd _cccc_hhhh_aaaa_rrrr. When functions that return an _iiii_nnnn_tttt are said to return a character, they return a positive value. Usually such functions can also return _EEEE_OOOO_FFFF (-1) as an error indication. The piece of memory that can hold a character is referred to as a _b_y_t_e. Thus, either a _cccc_hhhh_aaaa_rrrr_**** or an _uuuu_nnnn_ssss_iiii_gggg_nnnn_eeee_dddd _cccc_hhhh_aaaa_rrrr_**** can point to an array of bytes. PPPPaaaaggggeeee 1111 IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) The iostream package consists of several core classes, which provide the basic functionality for I/O conversion and buffering, and several specialized classes derived from the core classes. Both groups of classes are listed below. CCCCoooorrrreeee CCCCllllaaaasssssssseeeessss The core of the iostream package comprises the following classes: _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff This is the base class for buffers. It supports insertion (also known as _ssss_tttt_oooo_rrrr_iiii_nnnn_gggg or _pppp_uuuu_tttt_tttt_iiii_nnnn_gggg) and extraction (also known as _ffff_eeee_tttt_cccc_hhhh_iiii_nnnn_gggg or _gggg_eeee_tttt_tttt_iiii_nnnn_gggg) of characters. Most members are inlined for efficiency. The public interface of class _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff is described in _ssss_bbbb_uuuu_ffff_...._pppp_uuuu_bbbb(3C++) and the protected interface (for derived classes) is described in _ssss_bbbb_uuuu_ffff_...._pppp_rrrr_oooo_tttt(3C++). _iiii_oooo_ssss This class contains state variables that are common to the various stream classes, for example, error states and formatting states. See _iiii_oooo_ssss(3C++). _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm This class supports formatted and unformatted conversion from sequences of characters fetched from _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs. See _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++). _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm This class supports formatted and unformated conversion to sequences of characters stored into _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs. See _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++). _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm This class combines _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm and _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm. It is intended for situations in which bidirectional operations (inserting into and extracting from a single sequence of characters) are desired. See _iiii_oooo_ssss(3C++). _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______wwww_iiii_tttt_hhhh_aaaa_ssss_ssss_iiii_gggg_nnnn These classes add assignment operators and a constructor with no operands to the corresponding class _w_i_t_h_o_u_t _a_s_s_i_g_n_m_e_n_t. The predefined streams (see below) _cccc_iiii_nnnn, _cccc_oooo_uuuu_tttt, _cccc_eeee_rrrr_rrrr, and _cccc_llll_oooo_gggg, are objects of these classes. See _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm_((((_3333_CCCC_++++_++++), _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++), and _iiii_oooo_ssss(3C++). _IIII_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______iiii_nnnn_iiii_tttt This class is present for technical reasons relating to initialization. It has no public members. The _IIII_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______iiii_nnnn_iiii_tttt constructor initializes the predefined streams (listed below). Because an object of this class is declared in the _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh header file, the constructor is called once each time the PPPPaaaaggggeeee 2222 IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) header is included (although the real initialization is only done once), and therefore the predefined streams will be initialized before they are used. In some cases, global constructors may need to call the _IIII_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm______iiii_nnnn_iiii_tttt constructor explicitly to ensure the standard streams are initialized before they are used. PPPPrrrreeeeddddeeeeffffiiiinnnneeeedddd ssssttttrrrreeeeaaaammmmssss The following streams are predefined: _cccc_iiii_nnnn The standard input (file descriptor 0). _cccc_oooo_uuuu_tttt The standard output (file descriptor 1). _cccc_eeee_rrrr_rrrr Standard error (file descriptor 2). Output through this stream is unit-buffered, which means that characters are flushed after each inserter operation. (See _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_::::_::::_oooo_ssss_ffff_xxxx_((((_)))) in _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++) and _iiii_oooo_ssss_::::_::::_uuuu_nnnn_iiii_tttt_bbbb_uuuu_ffff in _iiii_oooo_ssss(3C++).) _cccc_llll_oooo_gggg This stream is also directed to file descriptor 2, but unlike _cccc_eeee_rrrr_rrrr its output is buffered. _cccc_iiii_nnnn, _cccc_eeee_rrrr_rrrr, and _cccc_llll_oooo_gggg are tied to _cccc_oooo_uuuu_tttt so that any use of these will cause _cccc_oooo_uuuu_tttt to be flushed. In addition to the core classes enumerated above, the iostream package contains additional classes derived from them and declared in other headers. Programmers may use these, or may choose to define their own classes derived from the core iostream classes. CCCCllllaaaasssssssseeeessss ddddeeeerrrriiiivvvveeeedddd ffffrrrroooommmm _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff Classes derived from _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff define the details of how characters are produced or consumed. Derivation of a class from _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff (the _pppp_rrrr_oooo_tttt_eeee_cccc_tttt_eeee_dddd _iiii_nnnn_tttt_eeee_rrrr_ffff_aaaa_cccc_eeee) is discussed in _ssss_bbbb_uuuu_ffff_...._pppp_rrrr_oooo_tttt(3C++). The available buffer classes are: _ffff_iiii_llll_eeee_bbbb_uuuu_ffff This buffer class supports I/O through file descriptors. Members support opening, closing, and seeking. Common uses do not require the program to manipulate file descriptors. See _ffff_iiii_llll_eeee_bbbb_uuuu_ffff(3C++). _ssss_tttt_dddd_iiii_oooo_bbbb_uuuu_ffff This buffer class supports I/O through stdio _FFFF_IIII_LLLL_EEEE structs. It is intended for use when mixing C and C++ code. New code should prefer to use _ffff_iiii_llll_eeee_bbbb_uuuu_ffffs. See _ssss_tttt_dddd_iiii_oooo_bbbb_uuuu_ffff(3C++). _ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff This buffer class stores and fetches characters from arrays of bytes in memory (i.e., strings). See _ssss_ssss_bbbb_uuuu_ffff(3C++). PPPPaaaaggggeeee 3333 IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) IIIIOOOOSSSS....IIIINNNNTTTTRRRROOOO((((3333CCCC++++++++)))) CCCCllllaaaasssssssseeeessss ddddeeeerrrriiiivvvveeeedddd ffffrrrroooommmm _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm,,,, _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm,,,, aaaannnndddd _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm Classes derived from _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm, _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm, and _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm specialize the core classes for use with particular kinds of _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs. These classes are: _iiii_ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm _oooo_ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm _ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm These classes support formatted I/O to and from files. They use a _ffff_iiii_llll_eeee_bbbb_uuuu_ffff to do the I/O. Common operations (such as opening and closing) can be done directly on streams without explicit mention of _ffff_iiii_llll_eeee_bbbb_uuuu_ffffs. See _ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++). _iiii_ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm _oooo_ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm These classes support ``in core'' formatting. They use a _ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff. See _ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++). _ssss_tttt_dddd_iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm This class specializes _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm for stdio _FFFF_IIII_LLLL_EEEEs. See _ssss_tttt_dddd_iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh. CCCCAAAAVVVVEEEEAAAATTTTSSSS Parts of the _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff class of the old stream package that should have been private were public. Most normal usage will compile properly, but any code that depends on details, including classes that were derived from _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs, will have to be rewritten. Performance of programs that copy from _cccc_iiii_nnnn to _cccc_oooo_uuuu_tttt may sometimes be improved by breaking the tie between _cccc_iiii_nnnn and _cccc_oooo_uuuu_tttt and doing explicit flushes of _cccc_oooo_uuuu_tttt. The header file _ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh exists for compatibility with the earlier stream package. It includes _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh, _ssss_tttt_dddd_iiii_oooo_...._hhhh, and some other headers, and it declares some obsolete functions, enumerations, and variables. Some members of _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff and _iiii_oooo_ssss (not discussed in these man pages) are present only for backward compatibility with the stream package. SSSSEEEEEEEE AAAALLLLSSSSOOOO _iiii_oooo_ssss(3C++), _ssss_bbbb_uuuu_ffff_...._pppp_uuuu_bbbb(3C++), _ssss_bbbb_uuuu_ffff_...._pppp_rrrr_oooo_tttt(3C++), _ffff_iiii_llll_eeee_bbbb_uuuu_ffff(3C++), _ssss_tttt_dddd_iiii_oooo_bbbb_uuuu_ffff(3C++), _ssss_ssss_bbbb_uuuu_ffff(3C++), _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++), _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++), _ffff_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++), _ssss_tttt_rrrr_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++), and _mmmm_aaaa_nnnn_iiii_pppp(3C++) PPPPaaaaggggeeee 4444