Possible Duplicate:
How can I delete a file pointed to by a FILE* in C?
I want to delete a file at the end of a C program, by which point the filename has been long forgotten. It would be nice if I could just use the FILE * to delete it directly or find the filename and then use remove()… rather than having to memorize the filename for this.
Does anybody know of any ways in which this could be achieved? I am on a Windows system, but I need to maintain portability so can’t use any OS specific stuff.
There’s no way to retrieve the file name from a
FILE *. AFILE *isn’t necessarily a real file; just think ofpopen(3)for example.