std::ifstream in("FileReadExample.cpp"); std::string contents((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());