\ .\" This man page was generated by the Netpbm tool 'makeman' from HTML source. .\" Do not hand-hack it! If you have bug fixes or improvements, please find .\" the corresponding HTML page on the Netpbm website, generate a patch .\" against that, and send it to the Netpbm maintainer. .TH "Netpbm subroutine library: pm_tmpfile() function" 3 "22 July 2004" "netpbm documentation" .SH NAME pm_tmpfile() - create a temporary unnamed file .SH SYNOPSIS .nf #include FILE * pm_tmpfile(void); .fi .SH EXAMPLE .PP This simple example creates a temporary file, writes 'hello world' to it, then reads back and prints those contents. .nf #include FILE * myfileP; myfile = pm_tmpfile(); fprintf(myfile, 'hello world\en'); fseek(myfileP, 0, SEEK_SET); fread(buffer, sizeof(buffer), 1, myfileP); fprintf(STDOUT, 'temp file contains '%s'\en', buffer); fclose(myfileP); .fi .SH DESCRIPTION .PP This library function is part of .BR Netpbm (1) . .PP \fBpm_tmpfile()\fP creates and opens an unnamed temporary file. It is basically the same thing as the standard C library \fBtmpfile()\fP function, except that it uses the \fBTMPFILE\fP environment variable to decide where to create the temporary file. If \fBTMPFILE\fP is not set or is set to something unusable (e.g. too long), \fBpm_tmpfile()\fP falls back to the value of the standard C library symbol \fBP_tmpdir\fP, just like \fBtmpfile()\fP. .PP Unlike \fBtmpfile()\fP, \fBpm_tmpfile()\fP never returns NULL. If it fails, it issues a message to Standard Error and aborts the program, like most libnetpbm routines do. .PP If you need to refer to the temporary file by name, use \fBpm_make_tmpfile()\fP instead. .SH HISTORY .PP \fBpm_tmpfile()\fP was introduced in Netpbm 10.20 (January 2004).