LIBMAKETMPFILE(3)
π LIBMAKETMPFILE β the Netpbm sub...() function manual, but make it cute π
okay bestie, so this is one of those Netpbm Library Functions Manual pages β specifically the one for a lil function called pm_make_tmpfile(). pull up a chair, grab a boba, we're doing this π§β¨
πΈ NAME πΈ
pm_make_tmpfile() β create a temporary named file
like, it makes you a temp file. with a name. iconic behavior honestly π
β¨ SYNOPSIS β¨
#include <netpbm/pm.h>
pm_make_tmpfile(FILE ** fileP,
const char ** filenameP);
so you give it two pointers-to-pointers and it fills them in for you. two stars each, no cap. ββ
π EXAMPLE π
okay so here's the whole vibe β this lil guy makes a temp file, writes "hello world" to it, then writes some search patterns in there, and then feeds the whole thing to grep like a snack. π
#include <netpbm/pm.h>
FILE * myfileP;
const char * myfilename;
pm_make_tmpfile(&myfileP, &myfilename);
fprintf(myfile, "^account:\\s.*\n");
fprintf(myfile, "^name:\\s.*\n");
fclose(myFileP);
asprintfN(&grepCommand, "grep --file='%s' /tmp/infile >/tmp/outfile");
system(grepCommand);
strfree(grepCommand);
unlink(myfilename);
strfree(myfilename);
π not me side-eyeing those variable names βmyfilevsmyfileP,myFilePvsmyfileP, and thatasprintfNcall missing an argument... bestie I am reporting what's in the page, not fixing it. copy it exactly, k? π«Ά
π DESCRIPTION π
This library function is part of Netpbm(1). π
pm_make_tmpfile() creates and opens a temporary file, and hands you back two things: a stream file handle for it, and its name. both. at once. slay. β¨
pm_make_tmpfile() picks a file name that is not already in use, with proper interlocking to make sure it actually creates a file and opens the new file β as opposed to merely opening some existing file. that distinction is the whole point, iykyk. π₯
If you don't need to access the file by name, use pm_tmpfile() instead, because it's cleaner. With pm_tmpfile(), the operating system always deletes the temporary file when your program exits β even if your program failed to clean up after itself. so like... it's the low-maintenance friend. π¦
The temporary file goes in the directory named by the TMPFILE environment variable. If TMPFILE is not set, or is set to something unusable (e.g. too long), pm_tmpfile() falls back to the value of the standard C library symbol P_tmpdir (like the standard C library's tmpfile()). so it's giving "we have a backup plan" energy π
The name of the file within that directory is like myprog_blrfx, where myprog is the name of your program (arg 0) and the rest is an arbitrary discriminator. so if your program is called myprog you get something like myprog_blrfx β cute, right? π
π important bestie warning: if pm_make_tmpfile() is unable to create a temporary file, it issues a message to Standard Error and aborts the program. like, full stop. no graceful exit. so handle your vibes accordingly. π
π HISTORY π
pm_tmpfile() was introduced in Netpbm 10.27 (March 2005). a true elder icon, we stan a legend π
π 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/libmaketmpfile.html
and that's the whole page bestie!! π₯³ no notes, ate, periodt π β¨
k bye, this was the netpbm documentation manual page, 10 November 2007, for the Netpbm sub...() function(3) β thanks for coming to my ted talk, love u, drink water π«ΆπΈπ
π¦ 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