When a file is open does unlink automatically deletes the file or it generates an error. Because I wrote a program to delete a file and regenerate the file. if the file is not deleted the data simply gets appended to the existing file. which results in wrong results