title: Is it safe to read stdin/cin from an ifstream?
body: <p>I've read that it's possible to read cin via an ifstream by changing the buffer, but is it safe? What are the disadvantages to doing it this way:</p>
  
  <p><code>file.ios::rdbuf(cin.rdbuf());</code></p>
  
  <p>Thanks<br>
  <br></p>
  
  <p><a href="http://www.tek-tips.com/viewthread.cfm?qid=1448313" rel="nofollow noreferrer">C++: UNIX - defaulting ifstream variable to standard input</a><br>
  <a href="https://stackoverflow.com/questions/2159452/c-assign-cin-to-an-ifstream-variable">iostream - C++: assign cin to an ifstream variable? - Stack Overflow</a>  </p>