Possible Duplicate:
Redirect cin to a string
I saw this post on how to redirect cout
to a string. But how to redirect the cin
to a string, just like redirecting cin
to a file using freopen
, so that when I do cin>>a_int;
, I will get an int from the string? Can I do similarly with setbuf (stdin , buffer);