#include
int main() {
FILE* fp;
fp = fopen(\"temp.txt\", \"w\");
fprintf(fp, \"Hello, World!\\n\");
// remove(\"temp.txt\"); this
I don't believe there's any way to do this, because a FILE* may not necessarily correspond to a file in the filesystem at all (For example, stdin and stdout).
And in filesystems that support hard links, there can be multiple paths referring to the same underlying file, which one would you want it to remove?