I want to have cin read input from a string.
Is there a way to have it do this?
Something like this:
const char * s = \"123 ab\"; cin.readFro
Like this:
#include #include std::istringstream stream("Some string 123"); streambuf* cin_backup = std::cin.rdbuf(stream.rdbuf());
You might want to back up the original rdbuf of std::cin, if you want to use it again.