TITLE: reading a file into a string (Source: comp.lang.c++, 22 Jan 2001) CANFIELD: stevecanfield@my-deja.com [snip] > What is a better way to read an entire text file into a std::string? KUEHL: "Dietmar Kuehl" std::ifstream in("some.file"); std::istreambuf_iterator beg(in), end; std::string str(beg, end); or std::ifstream in("some.file"); std::ostringstream tmp; tmp << in.rdbuf(); std::string str = tmp.str(); _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com