|
|
*
*
|
|
Each stream has a state, this state is defined in the ios class that both
istream and ostream derive from
There are many functions for manipulating the state of a stream, but there
are only four that you really need to know about for most I/O programming:
*cin.eof() - returns true if the end of file has been seen
*cin.fail() -returns true if the next operation will fail
*cin.bad() - returns true if the stream has been corrupted
*cin.good() - returns true if the next operation might succeed
|
|
|
|
|
*
|
|
The C printf and scanf functions provided formatted I/O, some of this is
handled by the >>and <<operators, but other parts, such as field width, are
not
Formatting is handled by the ios class. It handles most of the interaction
between the stream classes and their character buffers
We will briefly look at some of the formatting functions that are available
The flush()function is used to transfer all the characters in an output
buffer to the device it is connected to
This function is commonly used for streams connected to a display screen,
so information is on the screen when the user needs to see it
|
|