¡@

Home 

c++ Programming Glossary: cin.rdbuf

How to redirect cin and cout to files?

http://stackoverflow.com/questions/10150468/how-to-redirect-cin-and-cout-to-files

int main std ifstream in in.txt std streambuf cinbuf std cin.rdbuf save old buf std cin.rdbuf in.rdbuf redirect std cin to in.txt.. in.txt std streambuf cinbuf std cin.rdbuf save old buf std cin.rdbuf in.rdbuf redirect std cin to in.txt std ofstream out out.txt.. cout word output to the file out.txt f call function std cin.rdbuf cinbuf reset to standard input again std cout.rdbuf coutbuf..

Read from cin or a file

http://stackoverflow.com/questions/2407077/read-from-cin-or-a-file

0 if argc 2 input.open argv 1 if input return 1 orig_cin cin.rdbuf input.rdbuf cin.tie 0 tied to cout by default try normal program.. default try normal program using cin catch ... if orig_cin cin.rdbuf orig_cin throw return 0 Even though it's extremely rare to use..

Redirect cin to a string

http://stackoverflow.com/questions/4925150/redirect-cin-to-a-string

stream Some string 123 streambuf cin_backup std cin.rdbuf stream.rdbuf You might want to back up the original rdbuf of..

Redirecting I/O in Xcode 4

http://stackoverflow.com/questions/5490175/redirecting-i-o-in-xcode-4

main int argc const char argv ifstream arq getenv MYARQ cin.rdbuf arq.rdbuf string value cin value cout value return 0 that's.. it... only 2 lines of code ifstream arq getenv MYARQ cin.rdbuf arq.rdbuf it's not the best solution but until xcode have this..

How to send ostream via boost sockets in C++?

http://stackoverflow.com/questions/5675358/how-to-send-ostream-via-boost-sockets-in-c

std ostream request_stream request request_stream std cin.rdbuf std flush Send the request. boost asio write socket request..

Is it possible to “prepare” input from cin?

http://stackoverflow.com/questions/6013638/is-it-possible-to-prepare-input-from-cin

using namespace std int main streambuf coutbuf cout.rdbuf cin.rdbuf cout this goes to the input stream endl string s cin s cout.rdbuf.. #include sstream int main std stringstream s 32 7.4 std cin.rdbuf s.rdbuf int i double d if std cin i d std cout i ' ' d ' n'..

Copy a streambuf's contents to a string

http://stackoverflow.com/questions/877652/copy-a-streambufs-contents-to-a-string

from stdin into a string do std ostringstream ss ss std cin.rdbuf std string s ss.str Alternatively you may also use a istreambuf_iterator..