How to dump STDIN to a file, using C++ STL?

Posted by Jimm Chen on Stack Overflow See other posts from Stack Overflow or by Jimm Chen
Published on 2012-09-18T09:33:39Z Indexed on 2012/09/18 9:37 UTC
Read the original article Hit count: 194

Filed under:
|

HHello all, this is a straight forward question, but not a straight forward answer can be found by just Googling today.

Hope someone can show me a concise answer before I dig into those thick C++ books and finally find the solution out. Thank you.

I'm writing this program so to make a workaround in this issue: Why do I get 'Bad file descriptor' when trying sys.stdin.read() in subversion pre-revprop-change py script?

Note:

  • Content from STDIN may be arbitrary binary data.
  • Please use C++ STL functions, iostream, ifstream etc .
  • If the file creation/writing failed, I'd like to catch the exception to know the case.

© Stack Overflow or respective owner

Related posts about c++

Related posts about stl