I wanted to use fstream to read a txt file.
fstream
I am using inFile >> characterToConvert, but the problem is that this omits any spaces and newline.
inFile >> characterToConvert
I am writing an encryption program so I need to include the spaces and newlines.
What would be the proper way to go about accomplishing this?
ifstream ifile(path); std::string contents((std::istreambuf_iterator<char>(ifile)), std::istreambuf_iterator<char>()); ifile.close();