Check out example codes for "getline of file C++". It will help you in understanding the concepts better.

Code Example 1

ifstream inFile;
string name;
int age;

inFile.open("file.txt");

getline(inFile, name); 
inFile >> age; 

cout << name << endl;
cout << age << endl;  

inFile.close();

Learn ReactJs, React Native from akashmittal.com