1Netpbm subroutine library: pLNmie_bttrpmabprmfyislFueub(nr)cotufituoinnncsetiMloainnb(ur3aa)lry: pm_tmpfile() function(3)
2
3
4

NAME

6       pm_tmpfile() - create a temporary unnamed file
7
8

SYNOPSIS

10       #include <netpbm/pm.h>
11
12       FILE *
13       pm_tmpfile(void);
14
15

EXAMPLE

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       FILE * myfileP;
23
24       myfile = pm_tmpfile();
25
26       fprintf(myfile, "hello world\n");
27
28       fseek(myfileP, 0, SEEK_SET);
29
30       fread(buffer, sizeof(buffer), 1, myfileP);
31
32       fprintf(STDOUT, "temp file contains '%s'\n", buffer);
33
34       fclose(myfileP);
35
36
37

DESCRIPTION

39       This library function is part of Netpbm(1).
40
41       pm_tmpfile() creates and opens an unnamed temporary file.  It is  basi‐
42       cally  the  same  thing  as  the standard C library tmpfile() function,
43       except that it uses the TMPFILE environment variable to decide where to
44       create  the  temporary  file.  If TMPFILE is not set or is set to some‐
45       thing unusable (e.g.  too long), pm_tmpfile() falls back to  the  value
46       of the standard C library symbol P_tmpdir, just like tmpfile().
47
48       Unlike  tmpfile(),  pm_tmpfile()  never  returns NULL.  If it fails, it
49       issues a message to Standard Error and aborts the  program,  like  most
50       libnetpbm routines do.
51
52       If  you  need  to refer to the temporary file by name, use pm_make_tmp‐
53       file() instead.
54
55

HISTORY

57       pm_tmpfile() was introduced in Netpbm 10.20 (January 2004).
58

DOCUMENT SOURCE

60       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
61       source.  The master documentation is at
62
63              http://netpbm.sourceforge.net/doc/libtmpfile.html
64
65netpbm documentation       Netpbm22suJburloyut2i0n0e4library: pm_tmpfile() function(3)
Impressum