title: How to check if stdout has been redirected to NUL on Windows (a.k.a. /dev/null on Linux)?
body: <p>How can I check if my program's <code>stdout</code> has been redirected to <code>NUL</code>?<br>
  That way I can avoid outputting data since it's pointless.</p>
  
  <p>I mainly need this for Windows, but if you have a Linux solution, it might be helpful for others in the future, so feel free to post that as well.</p>