title: Input/output redirect from a command-line executable to file
body: <p>How can I save all the input(cin) and output(cout, cerr) from a program whose input is taken from file(using "&lt;")? I would like the input and output to be in order(<strong>so each input is followed by corresponding output as if I were typing the input in myself</strong>).</p>
  
  <p>I tried ">" to output everything to a file, but that only saves standard output(no input/cerr), and just plainly copying the command line output still only gives the output without the input(because of how "&lt;" works).</p>
  
  <p>Is there a way to write everything(output+input) to file <em>in order</em>?</p>
  
  <p>EDIT: edited for clarity</p>
  
  <p>EDIT2: I just realized that it's impossible to do what I'm trying to do since the console does not know anything about when the commands would actually be entered. I'll have to manually enter commands and use the "script" command to actually log all input/output.</p>