Read multiple files(.txt) c++
#include <sstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string filename;
ostringstream ss;
filename="data_";
for(int i;i<2;i++)
{
ss << filename << i;
FILE * f = fopen (ss.str(), "r");
if (NULL != f)
{
///.....some work
}
else
printf ("Could not open the file\n");
}
return 0;
}