Answers for "store the contents of a file into a string using c++"

C++
5

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;
}
Posted by: Guest on June-24-2020

Code answers related to "store the contents of a file into a string using c++"

Browse Popular Code Answers by Language