I am using this code fragment to read all content from a file to a string:
fstream file;
file.open("text.txt");
while(!file.eof()){
file >> line;
code += line;
}
file.close();
By trial and error I've been trying to put noskipws
in different places but had no luck so far.
the content of my file is: 87HBE MEHB4, which is Hello World encoded by Vigenere.
Where should I put noskipws or is there another elegant solution for this simple problem?