3 <<tmpfile64>>---create a large temporary file
12 FILE *tmpfile64(void);
14 FILE *_tmpfile64_r(void *<[reent]>);
17 Create a large temporary file (a file which will be deleted automatically),
18 using a name generated by <<tmpnam>>. The temporary file is opened with
19 the mode <<"wb+">>, permitting you to read and write anywhere in it
20 as a binary file (without any data transformations the host system may
21 perform for text files). The file may be larger than 2GB.
23 The alternate function <<_tmpfile64_r>> is a reentrant version. The
24 argument <[reent]> is a pointer to a reentrancy structure.
26 Both <<tmpfile64>> and <<_tmpfile64_r>> are only defined if __LARGE64_FILES
30 <<tmpfile64>> normally returns a pointer to the temporary file. If no
31 temporary file could be created, the result is NULL, and <<errno>>
32 records the reason for failure.
35 <<tmpfile64>> is a glibc extension.
37 Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
38 <<isatty>>, <<lseek64>>, <<open64>>, <<read>>, <<sbrk>>, <<write>>.
40 <<tmpfile64>> also requires the global pointer <<environ>>.
53 #ifdef __LARGE64_FILES
56 _tmpfile64_r (struct _reent
*ptr
)
66 if ((f
= _tmpnam_r (ptr
, buf
)) == NULL
)
68 fd
= _open64_r (ptr
, f
, O_RDWR
| O_CREAT
| O_EXCL
| O_BINARY
,
71 while (fd
< 0 && _REENT_ERRNO(ptr
) == EEXIST
);
74 fp
= _fdopen64_r (ptr
, fd
, "wb+");
75 e
= _REENT_ERRNO(ptr
);
78 (void) _remove_r (ptr
, f
);
79 _REENT_ERRNO(ptr
) = e
;
88 return _tmpfile64_r (_REENT
);
93 #endif /* __LARGE64_FILES */