This section is an introduction to C++ stream input and output. Section 2.2 explains the iostreams facility, how it works in principle, and how it should be used. This section should be read by anyone who needs basic information on iostreams. For readers who require deeper understanding, the section also gives an overview of the iostream architecture, its components, and class hierarchy.
It is not necessary to read Section 2.2 in order to start using predefined iostreams as explained in Section 2.3. However, we do recommend that you read the Users Guide's section on internationalization first, because iostreams is internationalized using standard C++ locales. The explanations in this section assume that you are familiar with locales and facets, and you will find countless references to the section on internationalization.
Sections 2.3 to 2.6 explain the basic operation of iostreams. These sections can be read sequentially, or used as a reference for certain topics. Read sequentially, they provide you with basic knowledge for working with iostreams. Used as a reference, they provide answers to questions like: How do I check for iostreams errors? and, How do I work with file streams?
Sections 2.7 to 2.11 explain simple techniques for extending the iostreams framework, such as defining input and output operators for user-defined types, and adding manipulators. These sections also cover more advanced features of iostreams, such as synchronization of streams.
Sections 2.12 and 2.13 explain advanced techniques for extending iostreams, such as creating new types of streams by derivation and defining a code conversion facet.
Section 2.14 describes the main differences between the Standard C++ Library iostreams and traditional iostreams.
Section 2.15 describes the main differences between the Standard C++ Library iostreams and the Rogue Wave implementation of iostreams in its own Standard C++ Library. It points out features that are specific to the Rogue Wave implementation.
The Appendix describes standardization issues that are still open at the time of this writing and influence the content of this document.
Please note that the examples in this User's Guide might not compile in your particular environment due to incompatibilities with the particular release of your compiler or your library. This is because few compilers available at the time of this printing are capable of understanding the whole range of language features defined by the ISO/ANSI C++ standard. It is likely that at least a few of these features will not be supported by your own compiler. The consequence is that some techniques demonstrated and explained in this User's Guide will not work with your compiler either.
We include examples that might not compile, rather than omitting certain techniques entirely, to demonstrate the full range of techniques the Standard C++ language will support. This User's Guide was written with an eye to the C++ of the future. Compilers will catch up, and techniques that don't work with your current compiler will work once your compiler can understand Standard C++. Hopefully, including these techniques will extend the usefulness of this User's Guide to you.
Also, the code examples are simplified in that the necessary #include <_> statements and the using directive for the standard namespace ::std are omitted. The intent is to make the examples as readable and focused as possible rather than ceaselessly repeating the same code fragments.
The Standard C++ Library consists mostly of class and function templates. Abbreviations for these templates are used throughout this User's Guide. For example, fstream stands for template <class charT, class traits> class basic_fstream. A slightly more succinct notation for a class template is also frequently used: basic_fstream <charT, traits>.
In addition to abbreviations, you will find certain contrived technical terms. For example, file stream stands for the abstract notion of the file stream class template; badbit stands for the state flag ios_base::badbit.
©Copyright 1996, Rogue Wave Software, Inc.