For formatted writes with fprintf()
, I'm using a FILE
pointer obtained from a file descriptor created by mkstemp()
(see this link):
fd = mkstemp(tmpName);
FILE *fp = fdopen(fd, "w");
fprintf(fp, "#EXTM3U\n");
What is the proper procedure to close the file?
fclose(fp) // only?
fclose(fp); // both?
close(fd);
close(fd); // only?