---
name: "libtmpfilefd"
section: "3"
platform: "linux"
package: "netpbm"
version: "10.86.51-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libtmpfilefd"
---

# libtmpfilefd(3)

create a temporary unnamed file

## NAME

pm\_tmpfile\_fd() - create a temporary unnamed file

## SYNOPSIS

```
#include <netpbm/pm.h>
FILE *
pm_tmpfile_fd(void);
```

## EXAMPLE

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

```
#include <netpbm/pm.h>
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);
```

## DESCRIPTION

This library function is part of **Netpbm**(1) .

**pm\_tmpfile\_fd()** is analogous to **pm\_tmpfile()**(1) .  The only difference is that it opens the file as a low level file, as **open()** would, rather than as a stream, as **fopen()** would.

If you need to refer to the temporary file by name, use **pm\_make\_tmpfile\_fd()** instead.

## HISTORY

**pm\_tmpfile()** was introduced in Netpbm 10.42 (March 2008).

## DOCUMENT SOURCE

This manual page was generated by the Netpbm tool 'makeman' from HTML source.  The master documentation is at

-

  **http://netpbm.sourceforge.net/doc/libtmpfilefd.html**
