LIBTMPFILE(3)
π LIBTMPFILE(3) β aka the pm_tmpfile() glow-up π
okay bestie, welcome to the Netpbm sub...) function(3) page, straight out of the Library Functions Manual β¨ this one's short, sweet, and lowkey iconic, so let's get into it π«Ά
β¨ NAME β¨
pm_tmpfile() β create a temporary unnamed file π
πΈ SYNOPSIS πΈ
#include <netpbm/pm.h>
FILE *
pm_tmpfile(void);
like. that's it. that's the whole vibe. π
π¦ EXAMPLE π¦
okay so here's a lil baby example that literally does the most: it makes a temp file, writes "hello world" into it, then reads it right back and prints what it found. main character behavior fr fr β¨
#include <netpbm/pm.h>
FILE * myfileP;
myfile = pm_tmpfile();
fprintf(myfile, "hello world\n");
fseek(myfileP, 0, SEEK_SET);
fread(buffer, sizeof(buffer), 1, myfileP);
fprintf(STDOUT, "temp file contains '%s'\n", buffer);
fclose(myfileP);
(and yes bestie, we are printing it exactly as the page has it, typos and all β not my job to fix the lore π)
π DESCRIPTION π
so this library function is part of Netpbm(1) π«Ά
pm_tmpfile() creates and opens an unnamed temporary file. it's basically the same thing as the standard C library tmpfile() function β same energy, same fit β except that it uses the TMPFILE environment variable to decide where to create the temporary file π
if TMPFILE is not set, or it's set to something unusable (e.g. too long π), then pm_tmpfile() falls back to the value of the standard C library symbol P_tmpdir, just like tmpfile() does. no cap, that's the fallback plan.
π¨ but here's the plot twist, and it's the good kind: unliketmpfile(),pm_tmpfile()never returnsNULL. if it fails, it issues a message to Standard Error and aborts the program, like most libnetpbm routines do. so like, it doesn't ghost you β it either shows up or it full-on ends the show π
if you need to refer to the temporary file by name, use pm_make_tmpfile() instead. that's the one for that job, bestie β¨
π HISTORY π
pm_tmpfile() was introduced in Netpbm 10.20 (January 2004) π a true elder icon, we respect her.
π DOCUMENT SOURCE π
this manual page was generated by the Netpbm tool 'makeman' from HTML source π the master documentation lives at:
http://netpbm.sourceforge.net/doc/libtmpfile.html
netpbm documentation Β· 22 July 2004 Β· Netpbm sub...) function(3) β ok that's the whole page bestie, you ate that, go forth and make ur unnamed temp files π πβ¨π¦πΈπ«Ά
π¦ where this page comes from
- centos-stream 10: netpbm-devel 11.09.00-1.el10 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- centos-stream 9: netpbm-devel 10.95.00-3.el9 Β· BSD and GPLv2 and IJG and MIT and Public Domain
- centos-stream 9: netpbm-devel 10.95.00-3.el9 Β· BSD and GPLv2 and IJG and MIT and Public Domain
- debian trixie: libnetpbm-dev 2:11.10.02-1 Β· MIT
- fedora 43: netpbm-devel 11.10.00-2.fc43 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- fedora 43: netpbm-devel 11.10.00-2.fc43 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- fedora 43: netpbm-devel 11.13.00-1.fc43 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- fedora 43: netpbm-devel 11.13.00-1.fc43 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- fedora 44: netpbm-devel 11.13.00-2.fc44 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- fedora 44: netpbm-devel 11.13.00-2.fc44 Β· BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
- opensuse-leap 16.0: libnetpbm-devel 11.9.3-160000.2.2 Β· BSD-3-Clause AND GPL-2.0-or-later AND IJG AND MIT AND SUSE-Public-Domain
- opensuse-leap 16.0: libnetpbm-devel 11.9.3-160000.2.2 Β· BSD-3-Clause AND GPL-2.0-or-later AND IJG AND MIT AND SUSE-Public-Domain
- opensuse-leap 16.0: libnetpbm-devel 11.9.3-160000.2.2 Β· BSD-3-Clause AND GPL-2.0-or-later AND IJG AND MIT AND SUSE-Public-Domain
- opensuse-leap 16.0: libnetpbm-devel 11.9.3-160000.2.2 Β· BSD-3-Clause AND GPL-2.0-or-later AND IJG AND MIT AND SUSE-Public-Domain
- ubuntu noble: libnetpbm-dev 2:11.05.02-1.1build1 Β· MIT
- ubuntu resolute: libnetpbm-dev 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: libnetpbm-dev 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms