LIBTMPFILEFD(3)

πŸ“¦
version 11.13.03 Β· 3 versions
, in centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

pm_tmpfile_fd() β€” bestie, it makes you a temporary unnamed file. That's the whole gig. No name, no drama, just vibes. ✨


🌸 SYNOPSIS 🌸

okay so first you gotta invite the header in:

#include <netpbm/pm.h>

FILE *
pm_tmpfile_fd(void);

that's it. that's the signature. she takes no arguments (it says void, she's booked and busy, no extra input needed πŸ’…).


πŸ¦‹ EXAMPLE πŸ¦‹

here's the cutest lil demo: make a temp file, write hello world into it, then read it right back and print what's inside. iconic behavior fr fr.

#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);
⭐ not me pointing out that the example calls pm_tmpfile() β€” that's literally what the original shows, so we're keeping it exactly as-is, no cap. 🫢

✨ DESCRIPTION ✨

so this library function is part of Netpbm(1), if you didn't already know. πŸ’–

pm_tmpfile_fd() is basically the twin sister of pm_tmpfile()(1) β€” same energy, one tiny glow-up. the only difference? she opens the file as a low level file, exactly like what open() would do, instead of opening it as a stream the way fopen() would. that's the whole plot twist. πŸŽ€

and listen β€” if you actually need to refer to your temporary file by name, this is not the function for you, bestie. use pm_make_tmpfile_fd() instead. she's the one who gives you a name. πŸ’…


🌈 HISTORY 🌈

pm_tmpfile() first showed up in Netpbm 10.42 (March 2008). a true icon of her era. πŸ‘‘


πŸŽ€ DOCUMENT SOURCE πŸŽ€

this manual page was generated by the Netpbm tool makeman straight from HTML source β€” so yes, she's a bot-made girly too, we love that for her. πŸ€–πŸ’–

the master documentation lives at:

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

and that's the whole page, bestie!! this was netpbm documentation, dated 31 December 2007, from the Netpbm sub...() function(3) manual. slay, read responsibly, and go make yourself an unnamed temp file. πŸ’…βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from