I wrote this little piece of code in order to read the content of a text file. I expected to see the variable "test" equal to the whole first line of the file. Instead, the variable got the value of he first word only. How could I get the whole line?
Here is the content of my test file(quotes for clarification):
"This is a test.
This is only the second line!"
void case_solve()
{
int R,i;
string linha;
vector<string> vet;
vector<vector<string>> w;
in >> R;
getline(in, linha);
cout << linha;
}
int _tmain(int argc, _TCHAR* argv[])
{
int i, cases;
in >> cases;
for (i = 1; i <= cases; i++)
{
case_solve();
}
}