Check out example codes for "how to add and read a file in c++ in visual studio". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>

using namespace std;

int main() {

	string input;
	fstream file;
	char ch; 


	cout << "Please enter the file name. ";
	cin >> input;

	file.open(input, ios::in);

	if (file) {

		file.get(ch);
		
		while (file) {
			cout << ch;
			file.get(ch);
		}
		file.close();
	}
	else {

		cout << "Error! " << endl;
	}


	system("pause");
	return 0;

}

Learn ReactJs, React Native from akashmittal.com