I need to read in a line from a file in c++ but need to save two strings as one. For example, if the the files line had someones name like Bernie Sanders, I would want to save the entire name into a string variable instead of just the first name.
>Solution :
I assume you are doing
std::string nameString;
fs >> nameString;
this will read to the end of a word.
do this instead
std::string nameString;
std::getline(fs, nameString);
this will read the whole line