|
|
1.1 root 1: /*
2: * tmpfile - return a pointer to an update file that can be
3: * used for scratch. The file will automatically
4: * go away if the program using it terminates.
5: */
6: #include <stdio.h>
7:
8: extern FILE *fopen();
9: extern int unlink();
10: extern char *tmpnam();
11: extern void perror();
12:
13: FILE *
14: tmpfile()
15: {
16: char tfname[L_tmpnam];
17: register FILE *p;
18:
19: (void) tmpnam(tfname);
20: if((p = fopen(tfname, "w+")) == NULL)
21: return NULL;
22: else
23: (void) unlink(tfname);
24: return(p);
25: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.