diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-05-19 02:07:39 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-05-19 02:07:39 +0000 |
commit | c1398e6d82599c98a4c85934be7609eb69d5852c (patch) | |
tree | 6e5d81882e231d99c8eb0548d841f211be5c3992 /libmaketmpfilefd.html | |
parent | fd23fd5cd716ef66faed317b8ff6139d0edea08e (diff) | |
download | netpbm-mirror-c1398e6d82599c98a4c85934be7609eb69d5852c.tar.gz netpbm-mirror-c1398e6d82599c98a4c85934be7609eb69d5852c.tar.xz netpbm-mirror-c1398e6d82599c98a4c85934be7609eb69d5852c.zip |
"miscellaneous update"
git-svn-id: http://svn.code.sf.net/p/netpbm/code/userguide@627 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'libmaketmpfilefd.html')
-rw-r--r-- | libmaketmpfilefd.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/libmaketmpfilefd.html b/libmaketmpfilefd.html new file mode 100644 index 00000000..baf6be99 --- /dev/null +++ b/libmaketmpfilefd.html @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> <head> +<title>Netpbm subroutine library: pm_make_tmpfile_fd() function</title> +<meta name="manual_section" content="3"> +</head> + +<body> +<h1>pm_make_tmpfile_fd()</h1> +Updated: 31 December 2007 +<br> + +<h2>NAME</h2> + +pm_make_tmpfile_fd() - create a temporary named file + +<h2>SYNOPSIS</h2> + +<pre> +#include <netpbm/pm.h> + +pm_make_tmpfile(int * fdP, + const char ** filenameP); +</pre> + +<h2>EXAMPLE</h2> + +<p>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 <b>grep</b>: + +<pre> +#include <netpbm/pm.h> + +int fd; +const char * myfilename; + +pm_make_tmpfile_fd(&fdP, &myfilename); + +write(fd, "^account:\\s.*\n", 16); +fprintf(fd, "^name:\\s.*\n", 13); + +close(fd); + +asprintfN(&grepCommand, "grep --file='%s' /tmp/infile >/tmp/outfile"); + +system(grepCommand); + +strfree(grepCommand); + +unlink(myfilename); + +strfree(myfilename); + +</pre> + +<h2>DESCRIPTION</H2> + +<p>This library function is part of <a href="index.html">Netpbm</a>. + +<p><b>pm_make_tmpfile_fd()</b> is analogous to <a +href="libmaketmpfile.html"><b>pm_make_tmpfile()</b></a>. The only +difference is that it opens the file as a low level file, as +<b>open()</b> would, rather than as a stream, as <b>fopen()</b> would. + +<p>If you don't need to access the file by name, use +<b>pm_tmpfile_fd()</b> instead, because it's cleaner. With +<b>pm_tmpfile_fd()</b>, the operating system always deletes the +temporary file when your program exits, if the program failed to clean +up after itself. + + +<h2>HISTORY</h2> + +<p><b>pm_tmpfile()</b> was introduced in Netpbm 10.42 (March 2008). + +</body> +</html> |