#include
int main() {
FILE* fp;
fp = fopen(\"temp.txt\", \"w\");
fprintf(fp, \"Hello, World!\\n\");
// remove(\"temp.txt\"); this
You may want to use the 'FILE * tmpfile(void)' function from stdlib.
from the man:
DESCRIPTION
The tmpfile() function shall create a temporary file and open a corresponding stream. The file shall be automatically deleted when all references to the file are closed. The file is opened as in fopen() for update (w+).
In some implementations, a permanent file may be left behind if the process calling tmpfile() is killed while it is processing a call to tmpfile().
An error message may be written to standard error if the stream cannot be opened.