C++-读写文件流操作-读写文件操作

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/OOFFrankDura/article/details/81702683

综述

C++操作文件流的方案很多
这里给出一个我比较喜欢的

代码

读入代码

 char*input1 =  "/Users/frankdura/Desktop/3D_task/aa.txt";

    ifstream readin(input1);
    string p;
    while (in_boundary >> p){   //读入边界点
      cout << p << endl;
    }

写入代码

#include <fstream>

ofstream out(filename);
    out << "hello world!";
    out << end;
    out.close();

猜你喜欢

转载自blog.csdn.net/OOFFrankDura/article/details/81702683