title: Redirecting std::cout when program is run as a service
body: <p>I have a c++ program that prints to the screen using std::cout.</p>
  
  <p>Sometimes I need to run it as a service. Is there any way of seeing the cout outputs when it's running as a Windows service?</p>
  
  <p>Redirecting the output to a file or some sort of debugging program would be ideal.</p>
  
  <p>Obviously I could replace the cout with a function that writes to a file, and that's probably what I'll do, but I'm curious to know if there are other solutions.</p>