summary refs log tree commit diff
path: root/libtmpfilefd.html
blob: 9019023c8c1d0930e173f720601207ef3161bb0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html> <head>
<title>Netpbm subroutine library: pm_tmpfile_fd() function</title>
<meta name="manual_section" content="3">
</head>

<body>
<h1>pm_tmpfile_fd()</h1>
Updated: 31 December 2007
<br>

<h2>NAME</h2>

pm_tmpfile_fd() - create a temporary unnamed file

<h2>SYNOPSIS</h2>

<pre>
#include &lt;netpbm/pm.h&gt;

FILE *
pm_tmpfile_fd(void);
</pre>

<h2>EXAMPLE</h2>

<p>This simple example creates a temporary file, writes "hello
world" to it, then reads back and prints those contents.

<pre>
#include &lt;netpbm/pm.h&gt;

int fd;

fd = pm_tmpfile();

write(fd, "hello world\n", 17);

lseek(fd, 0, SEEK_SET);

read(fd, buffer, sizeof(buffer));

fprintf(STDOUT, "temp file contains '%s'\n", buffer);

close(fd);

</pre>

<h2>DESCRIPTION</H2>

<p>This library function is part of <a href="index.html">Netpbm</a>.

<p><b>pm_tmpfile_fd()</b> is analogous to <a
href="libtmpfile.html"><b>pm_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 need to refer to the temporary file by name, use
<b>pm_make_tmpfile_fd()</b> instead.

<h2>HISTORY</h2>

<p><b>pm_tmpfile()</b> was introduced in Netpbm 10.42 (March 2008).

</body>
</html>