C++: read a whole file into a string.
using namespace std; ifstream fs(filename); string s; fs.seekg(0, ios::end); s.reserve( (size_t) fs.tellg() ); fs.seekg(0, ios::beg); s.assign( istreambuf_iterator<char>(fs), istreambuf_iterator<char>() );