IO: 向设备输入数据和输出数据C++的IO流
c++中,必须通过特定的已经定义好的类, 来处理IO(输入输出)
文件流: 对文件进行读写操作
头文件:
类库:
ifstream 对文件输入(读文件)
ofstream 对文件输出(写文件)
fstream 对文件输入或输出
//写文件
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
int age;
ofstream outfile; //也可以使用fstrea