I'm sure I posted this before, but it's short enough, probably not worth finding the previous answer:
std::ifstream in("transit_test.py");
std::stringstream buffer;
buffer << in.rdbuf();
Now buffer.str()is std::stringcontaining the content transit_test.py.
source
share