
std::basic_ifstream
文章平均质量分 87
C++标准库模板(STL)-输入/输出库 -std::basic_ifstream
繁星璀璨G
单身,求对象
展开
-
c++11 标准模板(STL)(std::basic_ifstream)(四)
检查文件流是否有关联文件。等效地调用 rdbuf()->is_open() 。将名为 filename 的文件打开并与文件流关联。失败时调用 setstate(failbit) 。成功时调用 clear() 。 (C++11 起) 1-2) 等效地调用 rdbuf()->open(filename, mode | ios_base::in).3-4) 等效地调用 (1-2) ,如同以 open(filename.c_str(), mode) 。关闭关联文件。原创 2023-08-02 08:30:00 · 279 阅读 · 0 评论 -
c++11 标准模板(STL)(std::basic_ifstream)(三)
移动赋值文件流 other 给 *this ,等效地移动赋值 std::basic_istream 基类和关联的 std::basic_filebuf 。将 other 置为无关联文件。注意基类移动赋值交换 *this 与 other 间的所有流状态变量(除了 rdbuf )。交换流与 other 的状态。通过调用 basic_istream::swap(other) 和 rdbuf()->swap(other.rdbuf()) 进行。返回指向底层未处理文件设备对象的指原创 2023-08-01 08:30:00 · 248 阅读 · 0 评论 -
c++11 标准模板(STL)(std::basic_ifstream)(二)
构造新的文件流。1) 默认构造函数:构造不关联到文件的流:默认构造 std::basic_filebuf 并构造拥有指向此默认构造的 std::basic_filebuf 成员的基类。2-3) 首先,进行同默认构造函数的步骤,4-5) 同 basic_ifstream(filename.c_str(), mode) 。6) 移动构造函数:首先,从 other 移动构造基类(这不影响 rdbuf() 指针),7) 复制构造函数被删除:此类不可复制。原创 2023-07-31 08:30:00 · 259 阅读 · 0 评论 -
c++11 标准模板(STL)(std::basic_ifstream)(一)
类模板 basic_ifstream 实现文件流上的高层输入操作。它将 std::basic_istream 的高层接口赋予基于文件的流缓冲( std::basic_filebuf )。std::basic_ifstream 的典型实现仅保有一个非导出数据成员: std::basic_filebuf 的实例。原创 2023-07-30 14:35:34 · 343 阅读 · 0 评论