12 | C++ Stream Input/Output | 737 |
12.1 | Introduction | 739 |
12.2 | Streams | 739 |
12.2.1 | Classic Streams vs. Standard Streams | 740 |
12.2.2 | iostream Library Header Files | 740 |
12.2.3 | Stream Input/Output Classes and Objects | 741 |
12.3 | Stream Output | 743 |
12.3.1 | Output of char* Variables | 743 |
12.3.2 | Character Output using Member Function put | 744 |
12.4 | Stream Input | 744 |
12.4.1 | get and getline Member Functions | 745 |
12.4.2 | istream Member Functions peek, putback and ignore | 748 |
12.4.3 | Type-Safe I/O | 748 |
12.5 | Unformatted I/O using read, write and gcount | 748 |
12.6 | Introduction to Stream Manipulators | 749 |
12.6.1 | Integral Stream Base: dec, oct, hex and setbase | 750 |
12.6.2 | Floating-Point Precision (precision, setprecision) | 751 |
12.6.3 | Field Width (width, setw) | 752 |
12.6.4 | Programmer-Defined Manipulators | 754 |
12.7 | Stream Format States and Stream Manipulators | 755 |
12.7.1 | Trailing Zeros and Decimal Points (showpoint) | 756 |
12.7.2 | Justification (left, right and internal) | 757 |
12.7.3 | Padding (fill, setfill) | 759 |
12.7.4 | Integral Stream Base (dec, oct, hex, showbase) | 760 |
12.7.5 | Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed) | 761 |
12.7.6 | Uppercase/Lowercase Control (uppercase) | 762 |
12.7.7 | Specifying Boolean Format (boolalpha) | 763 |
12.7.8 | Setting and Resetting the Format State via Member- Function flags | 764 |
12.8 | Stream Error States | 766 |
12.9 | Tying an Output Stream to an Input Stream | 768 |
13 | Exception Handling | 779 |
13.1 | Introduction | 780 |
13.2 | Exception-Handling Overview | 781 |
13.3 | Other Error-Handling Techniques | 783 |
13.4 | Simple Exception-Handling Example: Divide by Zero | 784 |
13.5 | Rethrowing an Exception | 788 |
13.6 | Exception Specifications | 789 |
13.7 | Processing Unexpected Exceptions | 790 |
13.8 | Stack Unwinding | 790 |
13.9 | Constructors, Destructors and Exception Handling | 792 |
13.10 | Exceptions and Inheritance | 793 |
13.11 | Processing new Failures | 793 |
13.12 | Class auto_ptr and Dynamic Memory Allocation | 797 |
13.13 | Standard Library Exception Hierarchy | 800 |
14 | File Processing | 808 |
14.1 | Introduction | 809 |
14.2 | The Data Hierarchy | 809 |
14.3 | Files and Streams | 811 |
14.4 | Creating a Sequential-Access File | 812 |
14.5 | Reading Data from a Sequential-Access File | 816 |
14.6 | Updating Sequential-Access Files | 823 |
14.7 | Random-Access Files | 824 |
14.8 | Creating a Random-Access File | 824 |
14.9 | Writing Data Randomly to a Random-Access File | 829 |
14.10 | Reading Data Sequentially from a Random-Access File | 831 |
14.11 | Example: A Transaction-Processing Program | 834 |
14.12 | Input/Output of Objects | 841 |