Objectives
In this chapter you’ll:
• Use C++ object-oriented stream input/output.
• Format input and output.
• Learn about the stream-I/O class hierarchy.
• Use stream manipulators.
• Control justification and padding.
• Determine the success or failure of input/output operations.
• Learn to tie output streams to input streams.
13.2.1 Classic Streams vs. Standard Streams
13.2.2 iostream
Library Headers
13.2.3 Stream Input/Output Classes and Objects
13.3.1 Output of char *
Variables
13.3.2 Character Output Using Member Function put
13.4.1 get
and getline
Member Functions
13.4.2 istream
Member Functions peek
, putback
and ignore
13.5 Unformatted I/O Using read
, write
and gcount
13.6 Introduction to Stream Manipulators
13.6.1 Integral Stream Base: dec
, oct
, hex
and setbase
13.6.2 Floating-Point Precision (precision
, setprecision
)
13.6.3 Field Width (width
, setw
)
13.6.4 User-Defined Output Stream Manipulators
13.7 Stream Format States and Stream Manipulators
13.7.1 Trailing Zeros and Decimal Points (showpoint
)
13.7.2 Justification (left
, right
and internal
)
13.7.3 Padding (fill
, setfill
)
13.7.4 Integral Stream Base (dec
, oct
, hex
, showbase
)
13.7.5 Floating-Point Numbers; Scientific and Fixed Notation (scientific
, fixed
)
13.7.6 Uppercase/Lowercase Control (uppercase
)
13.7.7 Specifying Boolean Format (boolalpha
)
13.7.8 Setting and Resetting the Format State via Member Function flags
13.9 Tying an Output Stream to an Input Stream