\ .\" 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_make_tmpfile_fd() function" 3 "31 December 2007" "netpbm documentation" .SH NAME pm_make_tmpfile_fd() - create a temporary named file .SH SYNOPSIS .nf #include pm_make_tmpfile(int * fdP, const char ** filenameP); .fi .SH EXAMPLE .PP This simple example creates a temporary file, writes "hello world" to it, then writes some search patterns to it, then uses it as input to \fBgrep\fP: .nf #include int fd; const char * myfilename; pm_make_tmpfile_fd(&fdP, &myfilename); write(fd, "^account:\e\es.*\en", 16); fprintf(fd, "^name:\e\es.*\en", 13); close(fd); asprintfN(&grepCommand, "grep --file='%s' /tmp/infile >/tmp/outfile"); system(grepCommand); strfree(grepCommand); unlink(myfilename); strfree(myfilename); .fi .SH DESCRIPTION .PP This library function is part of .BR "Netpbm" (1)\c \&. .PP \fBpm_make_tmpfile_fd()\fP is analogous to .BR "\fBpm_make_tmpfile()\fP" (1)\c \&. The only difference is that it opens the file as a low level file, as \fBopen()\fP would, rather than as a stream, as \fBfopen()\fP would. .PP If you don't need to access the file by name, use \fBpm_tmpfile_fd()\fP instead, because it's cleaner. With \fBpm_tmpfile_fd()\fP, the operating system always deletes the temporary file when your program exits, if the program failed to clean up after itself. .SH HISTORY .PP \fBpm_tmpfile()\fP was introduced in Netpbm 10.42 (March 2008). .SH DOCUMENT SOURCE This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at .IP .B http://netpbm.sourceforge.net/doc/libmaketmpfilefd.html .PP