What are you anticipating will be written to the file? And, I'm assuming that the "log file" you're talking about will be C:\output.txt, is that correct?
Also, keep in mind that modern versions of windows will require elevated permissions to be able to write to C:\ directly... Are you running this program at an elevated level?