C + + Primer Learning Summary Chapter 8th IO Library

Source: Internet
Author: User

8th IO Library


1. Io Class inheritance Relationship:



2. Query iostream stream Status p280-281

V is an int, when we enter 1, ' r ', or CTRL + Z when the output is as follows:


cin.clear () can clear all error bits so that the good () returns True.

3. FStream to read and write files P284

After the initial creation of the read-in and write-out FStream objects, the fin and fout are treated as CIN and cout completely, and their operations are almost indistinguishable.

4. An unpredictable bug occurs when you read and write to the same file at the same time.

For file operations, it is also recommended to use Ifstream and ofstream for streaming objects, because if you use FStream object +app mode the bug will occur.

File mode is commonly used in 6 kinds: In out app ate trunc binary. The first 5 kinds are relatively simple, binary is in 2 binary form to manipulate the file.

Here is an example of a binary file operation:

5. String Stream object Usage P287

Istringstream usage

Input and output results:

Ostringstream usage

Operation Result:

C + + Primer Learning Summary Chapter 8th IO Library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.