The <iostream> library automatically defines a few standard objects:
The <fstream> library allows programmers to do file input and output with the ifstream and ofstream classes. C++ programmers can also do input and output from strings by using the stringstream class.
Some of the behavior of the C++ I/O streams (precision, justification, etc) may be modified by manipulating various I/O stream format flags.
| I/O Constructors | constructors |
| bad | true if an error occurred |
| clear | clear and set status flags |
| close | close a stream |
| eof | true if at the end-of-file |
| exceptions | set the stream to throw exceptions on errors |
| fail | true if an error occurred |
| fill | manipulate the default fill character |
| flags | access or manipulate io_stream_format_flags |
| flush | empty the buffer |
| gcount | number of characters read during last input |
| get | read characters |
| getline | read a line of characters |
| good | true if no errors have occurred |
| ignore | read and discard characters |
| is_open | check if a file is open |
| open | open a new stream |
| peek | check the next input character |
| precision | manipulate the precision of a stream |
| put | write characters |
| putback | return characters to a stream |
| rdstate | returns the state flags of the stream |
| read | read data into a buffer |
| seekg | perform random access on an input stream |
| seekp | perform random access on output streams |
| setf | set format flags |
| sync_with_stdio | synchronize with standard I/O |
| tellg | read input stream pointers |
| tellp | read output stream pointers |
| unsetf | clear io_stream_format_flags |
| width | access and manipulate the minimum field width |
| write | write characters |