The DeleteFile function can be used to delete a file on close

I need a DeleteFile function.
which can remove a file automatically when a program is closed.
Please give me the DeleteFile function/method to delete a file on close in c++.