1Netpbm subroutine libraryN:etpLpmib_bmtrmasprufybirlFoeuu_ntfcidtn(ie)onlfsiubnMrcaatnriuyoa:nl(p3m)_tmpfile_fd() function(3)
2
3
4
6 pm_tmpfile_fd() - create a temporary unnamed file
7
8
10 #include <netpbm/pm.h>
11
12 FILE *
13 pm_tmpfile_fd(void);
14
15
17 This simple example creates a temporary file, writes 'hello world' to
18 it, then reads back and prints those contents.
19
20 #include <netpbm/pm.h>
21
22 int fd;
23
24 fd = pm_tmpfile();
25
26 write(fd, 'hello world\n', 17);
27
28 lseek(fd, 0, SEEK_SET);
29
30 read(fd, buffer, sizeof(buffer));
31
32 fprintf(STDOUT, 'temp file contains '%s'\n', buffer);
33
34 close(fd);
35
36
37
39 This library function is part of Netpbm(1).
40
41 pm_tmpfile_fd() is analogous to pm_tmpfile()[22m(1).Theonlydifferenceis
42 that it opens the file as a low level file, as open() would, rather
43 than as a stream, as fopen() would.
44
45 If you need to refer to the temporary file by name, use pm_make_tmp‐
46 file_fd() instead.
47
48
50 pm_tmpfile() was introduced in Netpbm 10.42 (March 2008).
51
52
53
54netpbm documentation Netpbm 3s1ubDreocuetmibneerl2i0b0r7ary: pm_tmpfile_fd() function(3)