getline in c++ from file code example
Example 1: c++ reading string
#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Example 2: getline of file C++
ifstream inFile;
string name;
int age;
inFile.open("file.txt");
getline(inFile, name);
inFile >> age;
cout << name << endl;
cout << age << endl;
inFile.close();