#include
int main(void) {
char tmpname[L_tmpnam];
char *filename = NULL;
FILE *tmpfp;
filename = tmpnam(tmpname);
printf("Temp file: %s\n", filename);
tmpfp = tmpfile();
if(tmpfp)
printf("Opened a temp file: OK\n");
else
perror("tmpfile");
return 0;
}