Select Page

The ios Class

The ios class is the granddaddy of all the stream classes, and contains the majority of the features you need to operate C++ streams. The three most important features are the formatting flags, the error-status nags, and the file operation mode. We’ll  look at formatting nags and error-status nags next. We’ll save the file operations mode for later, when we talk about disk files.

Formatting Flags

Formatting flags are a set of alum definitions in ios. They act as on/off switches that specify choices for various aspects of input and output format and operation. We won’t provide a detailed discussion of each flag, since we’ve already seen some of them in use, and others are more or less self-explanatory: Some we’ll discuss later in this chapter. Table 12.1 is a complete list of the formatting flags.

The ios Class

The ios Class

There are several ways to set the formatting flags, and different ones can be set in different ways. Since they are ‘members of the ios class, you must usually prece-l- them with the name ios and the scope-resolution operator (for example, ios: : skipws). All the flags can be set using the setf () and unsetf () ios member functions. Look at the following example:

Many formatting flags can be set using manipulators, so lets look at them now.

Pin It on Pinterest

Share This