3 <<tmpfile>>---create a temporary file
14 FILE *_tmpfile_r(void *<[reent]>);
20 FILE *_tmpfile_r(<[reent]>)
24 Create a temporary file (a file which will be deleted automatically),
25 using a name generated by <<tmpnam>>. The temporary file is opened with
26 the mode <<"wb+">>, permitting you to read and write anywhere in it
27 as a binary file (without any data transformations the host system may
28 perform for text files).
30 The alternate function <<_tmpfile_r>> is a reentrant version. The
31 argument <[reent]> is a pointer to a reentrancy structure.
34 <<tmpfile>> normally returns a pointer to the temporary file. If no
35 temporary file could be created, the result is NULL, and <<errno>>
36 records the reason for failure.
39 Both ANSI C and the System V Interface Definition (Issue 2) require
42 Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
43 <<isatty>>, <<lseek>>, <<open>>, <<read>>, <<sbrk>>, <<write>>.
45 <<tmpfile>> also requires the global pointer <<environ>>.
52 _DEFUN (_tmpfile_r
, (ptr
),
60 if ((f
= _tmpnam_r (ptr
, buf
)) == NULL
)
62 fp
= _fopen_r (ptr
, f
, "wb+");
64 _CAST_VOID
_remove_r (ptr
, f
);
74 return _tmpfile_r (_REENT
);