#include
#include
using namespace std;
int main(void)
{
ifstream infile;
infile.open("你要打开文件的路径", ios::in)// 第二个参数是文件打开模式
infile.read();
infile.get();
inflie.getline(); //这三个函数都用于读取内容,具体参数可以查看C++标准函数库
//其他操作
infile.close();//记得关闭
ofstream oufile;//用法同上
}
//C++流操作基本上都是差不多的,建议查看MSDN 或者C++标准函数库,内容比我说的要详细
std::ofstream output("filename");
//这是output的用法和cout的是一致的
//最后把文件关掉
output.close();//这一句不写也可以,C++会帮你处理,这一点是比C要好的地方
ofstream outfile;
outfile.open("f1.dat",ios::out);//使文件流与f1.dat文件建立关联
outfile.close();//关闭