title: Detect if stdin is a terminal or pipe?
body: <p>When I execute "<code>python</code>" from the terminal with no arguments it brings up the Python interactive shell.</p>
  
  <p>When I execute "<code>cat | python</code>" from the terminal it doesn't launch the interactive mode. Somehow, without getting any input, it has detected that it is connected to a pipe.</p>
  
  <p>How would I do a similar detection in C or C++ or Qt?</p>