1Netpbm subroutine liNbertaprbym:spLumib_brmroaaukrteyi_ntFemupnlfciitblireoa_nrfsyd:(M)apnmfu_uamnlacktei_otnm(p3f)ile_fd() function(3)
2
3
4

NAME

6       pm_make_tmpfile_fd() - create a temporary named file
7
8

SYNOPSIS

10       #include <netpbm/pm.h>
11
12       pm_make_tmpfile(int *         fdP,
13                       const char ** filenameP);
14
15

EXAMPLE

17       This  simple  example creates a temporary file, writes "hello world" to
18       it, then writes some search patterns to it, then uses it  as  input  to
19       grep:
20
21       #include <netpbm/pm.h>
22
23       int fd;
24       const char * myfilename;
25
26       pm_make_tmpfile_fd(&fdP, &myfilename);
27
28       write(fd, "^account:\\s.*\n", 16);
29       fprintf(fd, "^name:\\s.*\n", 13);
30
31       close(fd);
32
33       asprintfN(&grepCommand, "grep --file='%s' /tmp/infile >/tmp/outfile");
34
35       system(grepCommand);
36
37       strfree(grepCommand);
38
39       unlink(myfilename);
40
41       strfree(myfilename);
42
43
44

DESCRIPTION

46       This library function is part of Netpbm(1).
47
48       pm_make_tmpfile_fd()  is  analogous  to pm_make_tmpfile()(1).  The only
49       difference is that it opens the file as a low  level  file,  as  open()
50       would, rather than as a stream, as fopen() would.
51
52       If  you  don't  need  to  access  the file by name, use pm_tmpfile_fd()
53       instead, because it's cleaner.   With  pm_tmpfile_fd(),  the  operating
54       system  always  deletes  the temporary file when your program exits, if
55       the program failed to clean up after itself.
56
57
58

HISTORY

60       pm_tmpfile() was introduced in Netpbm 10.42 (March 2008).
61

DOCUMENT SOURCE

63       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
64       source.  The master documentation is at
65
66              http://netpbm.sourceforge.net/doc/libmaketmpfilefd.html
67
68netpbm documentationNetpbm subro3u1tiDneecelmibberrar2y0:07pm_make_tmpfile_fd() function(3)
Impressum