#include <stdio.h> int main(void){ char tmpname[L_tmpnam]; char *filename; FILE *fp; strcpy(tmpname,"/tmp/dfXXXXXX");//file name:df... filename=mktemp(tmpname);//generate tempfile printf("temporary file name:%s\n",filename); fp=tmpfile(); if (fp) printf("temporary file oepn.\n"); else perror("error"); exit(0); }