1#include <sstream>
2#include <iostream>
3#include <string>
4
5using namespace std;
6int main()
7{
8 string filename;
9 ostringstream ss;
10 filename="data_";
11 for(int i;i<2;i++)
12 {
13 ss << filename << i;
14 FILE * f = fopen (ss.str(), "r");
15 if (NULL != f)
16 {
17 ///.....some work
18 }
19 else
20 printf ("Could not open the file\n");
21 }
22 return 0;
23}