1
0
Files
irix-657m-src/eoe/man/man3s/tmpfile.3s
2022-09-29 17:59:04 +03:00

71 lines
1.6 KiB
Plaintext

'\"macro stdmacro
.if n .pH g3s.tmpfile @(#)tmpfile 30.2 of 12/25/85
.nr X
.if \nX=0 .ds x} TMPFILE 3S "C Programming Language Utilities" "\&"
.if \nX=1 .ds x} TMPFILE 3S "C Programming Language Utilities"
.if \nX=2 .ds x} TMPFILE 3S "" "\&"
.if \nX=3 .ds x} TMPFILE "" "" "\&"
.TH \*(x}
.SH NAME
tmpfile \- create a temporary file
.SH SYNOPSIS
.B #include <stdio.h>
.PP
.B
.SM FILE
.B "\(**tmpfile (void);"
.SH DESCRIPTION
.I tmpfile\^
creates a temporary file,
and returns a
corresponding
.SM FILE
pointer.
The file is created on the temporary directory indicated by
the string
.B P_tmpdir
in
.IR <stdio.h> .
If the file cannot be opened,
a
.SM NULL
pointer is returned.
Upon return from
.IR tmpfile ,
you may print an
error message using
.IR perror (3C),
to determine the reason for the failure.
A success call to
.IR tmpfile
will create a temporary file just long enough
to obtain the
.SM FILE
pointer, then delete the file with \f2unlink(2)\fP,
and finally return the
.SM FILE
pointer to the calling process.
Thus, the only means of accessing the temporary
file is though the
.SM FILE
pointer.
The file is opened for update ("w+").
.PP
Although the name of the temporary file is generated
similarly to those produced by
.IR tmpnam (3S),
.I tmpfile
uses its own algorithm to generate filenames similar to, but
unique from, those generated by
.IR tmpnam .
This allocates the entire space of
.IR tmpnam -generated
names to applications code. (See
.IR tmpnam (3S)
for more information.)
.SH SEE ALSO
creat(2), unlink(2), fopen(3S), mktemp(3C), perror(3C), stdio(3S), tmpnam(3S).
'\".so /pubs/tools/origin.att
.\" @(#)tmpfile.3s 6.2 of 10/20/83
.Ee