创建文件指针数组c++

#include<fstream>
using namespace std; 

void main()
{
for (int i=0; i<=1; i++) {
char szName[100] = {''};
sprintf(szName, "e:\text%d.txt", i); //格式化输出文件名
ofstream fout( szName ); //打开文件、、fopen(szfname,"wb");
if ( fout.is_open() ) {

fout << "hello!" << endl; //写数据

fout.close(); //关闭文件
}
}

原文地址:https://www.cnblogs.com/8335IT/p/8514965.html