First of all you are still using void main(). See my signature.

Secondly, you do realize that writing to a file is one of the most common operations you have to do in programming. Just saying you couldn't find a way to do this is extremely suspicious. What exactly have you read about and why did it not help with your problem?