1 #include
2 #include "stdio.h"
3 #define MAXLINE 8192
4 main()
5 {
6 char name[L_tmpnam], line[MAXLINE];
7 FILE *fp;
8 printf("%s\n",tmpnam(NULL));
9 tmpnam(name);
10 printf("%s\n", name);
11 if((fp = tmpfile()) == NULL)
12 printf("tmpfile error");
13 fputs("one line of output\n", fp);
14 rewind(fp);
15 if(fgets(line, sizeof(line), fp) == NULL)
16 printf("fgets error");
17 fputs(line, stdout);
18 exit(0);
19 }