toaruos/libc/stdio/tmpfile.c
2018-06-25 12:11:33 +09:00

16 lines
231 B
C

#include <stdio.h>
#include <unistd.h>
FILE * tmpfile(void) {
static int tmpfile_num = 1;
char tmp[100];
sprintf(tmp, "/tmp/tmp%d.%d", getpid(), tmpfile_num++);
FILE * out = fopen(tmp, "w+b");
unlink(tmp);
return out;
}