c++primer 第八章 - IO库
1 IO库概述
iostream 处理控制台IO
fstream 处理命名文件IO
stringstream 完成内存string的IO
类 fstream和stringstream 都继承自类iostream的。
2 IO库类型和头文件
3 文件输入输出
3.1 特有操作
3.2 mod 怎么选择:
3.3 文件读写操作
将fstream 和 文件绑定;然后对fstream的操作就是对文件的操作;
例如1:
fstream input;
input.open(d:/infile.txt);
if(input.is_open())
input<<"This is a infile !"
input.close();
例如2:
fstream fstream("E://学习//me.txt",ofstream::in | ofstream::out | ofstream::app);
fstream << "sdf dsf " << endl;
3 string流
例: