Load a text file to a string using STL streams

by ixmx


#include <iostream>

#include <fstream>

ifstream ifs("path\\filename.ext");

if(ifs.is_open())
{
    string file_content( ( istreambuf_iterator<char>(ifs) ),  istreambuf_iterator<char>() );
}
Advertisements