Code to write a program to a file

Can someone send me the basic code for writing output of a program to a file? I can't seem to find it online and I need it to complete a project. Thank You!
That's the one I found earlier. Thank you for confirming it works!
Topic archived. No new replies allowed.