您的位置:首页 > 其它

【关于实验】批量打开文件(用于自动读写数据)

2014-09-14 19:09 260 查看
#include<iostream>

#include<vector>

#include<fstream>

#include<string>

using namespace std;

void main()

{

//string str("hello.txt\0");

char *a[] = {"1.txt\0","2.txt\0"}; //用于vector的初始化

vector<string> file_set(a, a+2);

for(unsigned i = 0; i < file_set.size(); ++i)

{

ofstream outfile(file_set[i]);

outfile << "hello?baby";

outfile.close();

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: