Check out example codes for "Read multiple files(.txt) c++". It will help you in understanding the concepts better.

Code Example 1

#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;
}

Learn ReactJs, React Native from akashmittal.com