title: Is there a way to determine whether stdout is pointing to the console?
body: <p>I would like to insert code into a C++ application running on Windows that can determine whether stdout (or cout) is pointing to the console, and if it is, convert characters to terminal encoding before writing them out. If not (for instance, if writing to a file or pipe), the characters should be left alone. The conversion part is not a problem, but I'm wondering whether it's even possible for an application to know whether its stdout is going to the console or elsewhere. </p>
  
  <p>I am not sure whether the Windows API function GetStdHandle would be of any help, or whether it simply is a means of pointing to the stdout without being able to determine any information about it. Likewise, I'm not sure whether there's any information that we can obtain from cout that would indicate whether it's pointing to a console or something else. So far, I haven't been able to find anything along those lines.</p>