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 an
inFile >> characterToConvert
Another better way is to use istreambuf_iterator, and the sample code is as below:
ifstream inputFile("test.data"); string fileData(istreambuf_iterator(inputFile), istreambuf_iterator());