Click on the banner to return to the user guide home page.

©Copyright 1996, Rogue Wave Software, Inc.


ASCII stands for American Standard Code for Information Interchange. A 7-bit code is used in the US.
Generally, a digraph is a combination of characters that is written separately, but forms a single lexical unit.
EBCDIC stands for "extended binary coded decimal interchange code. It is a single-byte character set developed by IBM.
ISO 10646 is the encoding of the International Standards Organization.
Unicode was developed by the Unicode Consortium. It is code-for-code equivalent to the 16-bit ISO 10646 encoding.
ISO C also defines internationalization services in the programming language C. The respective ISO standard is ISO/IEC 9899 and its Amendment 1. The ISO C standard is identical to the POSIX standard for the programming language C. The internationalization services defined by ISO C are part of XPG4. However, XPG4 offers more services than ISO C, such as localization support.
The example is oversimplified. One would certainly use the strfmon() function for formatting monetary values like prices. We will consider more realistic examples in section .
A good reference for an explanation of the handle-body idiom is: "Advanced C++ Programming Styles and Idioms," James O. Coplien, Addison-Wesley, 1992, ISBN 0-201-54855-0.
A byname facet creates a facet from the external representation of a C locale. See section for the naming conventions of facet names.
The destructor is inaccessible to the public because it is assumed that a locale owns its facets and manages their storage.
Note that the use of the put() function of a formatting facet is inherently unsafe, if you work with output iterators other than output stream buffer iterators. It is especially dangerous if you work with output iterators that refer to fixed-size containers, like a C++ array for example. There is no way to check whether the facet does not write beyond the containers end.
You might be surprised to find the string representation of boolean values in the numpunct facet, because bool values are not numerical values. However, that's the way the facets are organized.
Generally, an umlaut is a composed character consisting of a vowel as the base character and a diaeresis, that is, two dots placed over a vowel, as the diacritic. The diaeresis is used in German and other European languages to indicate a change in the pronunciation of the vowel.
The classes strstream, istrstream, and ostrstream are described in the Class Reference, but not this User's Guide. These classes are sometimes called deprecated features in the standard; i.e., they are provided solely for the sake of compatibility with the traditional iostreams, and will not be supported in future versions of the standard iostreams.
The shift operators for the character types, like char and wchar_t, are an exception to this rule; they are global functions in the standard library namespace ::std.
Iostreams does not prevent you from setting other invalid combinations of these flags, however.
Initially, none of the bits is set. This is more or less equivalent to left.
The classification of a character as a white space character depends on the character set used. The extractor takes the information from the locale's ctype facet.
The stream buffer can be created as the stream's responsibility, or the buffer can be provided from outside the stream, so inadvertently the buffer could have zero size.
Actually, the standard does not yet specify how memory allocation errors are to be handled in iostreams. Basically, the two models are:
- A bad_alloc exception is thrown, regardless of whether or not any bits in the exception mask are set.

- The streams layer catches bad_alloc exceptions thrown during allocation of its internal resources, iword and pword. It would then set badbit or failbit. An exception would be thrown only if the respective bit in the exception mask asks for it. It must be specified whether the exception thrown in such a case would be ios_failure or the original bad_alloc.

Moreover, the streams layer must catch all exceptions thrown by the stream buffer layer. It sets badbit and rethrows the original exception if the exception mask permits it.

Note that each change of either the stream state or the exception mask can result in an exception thrown. This is because the functions steatite() and exception() raise an exception in case the exception mask requires it.
See Bjarne Stroustrup, The C++ Programming Language, p.308ff.
. For output file streams the open mode out is equivalent to out|trunc, i.e. you can omit the trunc flag. For bidirectional file streams, however, trunc must always be explicitly specified.
Basically the binary mode flag is passed on to the respective operating system's service function, which means that in principle all system-specific conversions will be suppressed, not only the carriage return / linefeed handling.
An alternative could be to provide Manip as a static or a global object at the user's convenience. Unfortunately, this approach would introduce the well-known order-of-initialization problems for global and static objects.
See functions strftime(), strptime(), and wcsftime() in X/Open for reference.
This, of course, is a toy example. You would probably never derive a new class for adding only one data member. However, it keeps the example simple and allows us to demonstrate the principle of deriving new stream classes.
For a more detailed discussion of the problem and its solution, see Section 14.2, p. 306ff, of Bjarne Stroustrup, "The Design and Evolution of C++," Addison-Wesley 1994.
An introduction to this technique can also be found in Section 6.10, p. 90ff, of Steve Teale's "C++ IOStreams Handbook," Addison-Wesley 1993. Watch out, the example given there has several severe bugs!
In our example of a conversion between ASCII and EBCDIC, we have no reason to ever return partial, because this is a conversion of single byte characters. Either a character can be recognized and converted, or the conversion fails; that is, error will be returned. The partial return code only makes sense in wide-character and multibyte conversions.
The list in this section is not meant to be complete, since this is a preliminary release of the User's Guide.

©Copyright 1996, Rogue Wave Software, Inc.