How do you clear a file at the beginning of a program?

Okay, I'm writing a program that converts hex to letters and writes the letters to a file.

To write I'm currently using
ofstream("output.txt" ios::app)

But the issue with this is, is that everytime I run the program, it appends and doesn't write from the beginning of the text file.

So what I want to know is, how do I clear the contents of a text file, before writing to it?
Don't use ios::app and the file will automatically be cleared before writing instead of appending.
Topic archived. No new replies allowed.