C + + Primer---reading notes 8

Source: Internet
Author: User

Standard IO Library
The standard library supports wchar_t types. Each class is prefixed with the W prefix. Such as
Wostream,wistream,wiostream <iostream>
Wifstream,wofstream,wfstream <fstream>
Wistringstream,wostringstream,wstringstream <sstream>

IO objects cannot be assigned or copied:
Only element types that support replication can be stored in vectors and other container classes;
The formal parameter or return type cannot be a stream type.


Condition Status: S.eof () S.fail () S.bad () S.good ()
S.setstate (flag) S.clear ()

You should use Endl to guarantee refreshing the buffer.
When input and output are bound together, any input causes the buffer associated with the output stream to be refreshed first.
The standard library has cout and Cin tied together.

The tie function can be used on Istream,ostream objects using a pointer parameter that points to the Ostream object.
Call the function to bind the argument stream to the object of the function.

Input and output of file:
Historically, the IO standard library uses a C-style string. You can call the C_STR member to get the C-style string.

If programmers want to reuse file streams to read and write to multiple files, they must close open files before reading another file, and then call clear to purge the state of the stream.

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.