title: How do I write to cin, the input stream, in C++
body: <p>So I have a program (a game) designed to take input from a human via a keyboard.  It is desirable, however, that at certain points I take control away from the user and make certain decisions for them.  While it would be possible to write special-case code for use when events force the effects of user input to be emulated, I would much prefer to override the input stream (cin in this case) so that the program is in fact responding no different to forced decisions than had the user made such a decision of their own free will.</p>
  
  <p>I have tried writing to it like I would an output stream (<code>cin&lt;&lt;'z'</code> for example) but the &lt;&lt; operator isn't defined for cin and I don't know how to define it.  </p>
  
  <p>Would it be better to write to the keyboard buffer?  If so, how would I do that in a system agnostic manner?</p>