I am trying to read a line from a file that has spaces in it. Despite everything I've tried and all my research, nothing seems to work, here is my current attemp
void read_name(fstream& in_file, comp& cmp)
{
char buff[80];
in_file.getline(buff, 79, '\n');
in_file >> buff;
cout << "NAME: " << buff << endl;
cmp.set_name(buff);
in_file.getline(buff, 79);
}
For whatever reason, this will still read until it sees a space and then stops. Any help would be much appreciated. I'm not that great with straight C++ so I could very well just be missing something.