how to copy all contents of a file into a string cpp code example
Example: c++ file to string
string filetostring(){
ifstream file("file", ios::binary);
string fileStr;
istreambuf_iterator<char> inputIt(file), emptyInputIt;
back_insert_iterator<string> stringInsert(fileStr);
copy(inputIt, emptyInputIt, stringInsert);
return fileStr;
}