PMPRINTF(3)
π PMPRINTF π
okay bestie, sit down, hydrate, because we're talking about pmprintf and pmflush β the little duo from the PCP Library Functions Manual that prints your formatted output in a window or straight to standard error. it's giving "fprintf but make it β¨choicesβ¨". no cap.
πΈ NAME πΈ
pmprintf, pmflush β print formatted output in a window or to standard error π«Ά
β¨ C SYNOPSIS β¨
#include <pcp/pmapi.h>
int pmprintf(const char *fmt, ... /*args*/);
int pmflush(void);
cc ... -lpcp
π¦ DESCRIPTION π¦
so the way this works, bestie: you take pmprintf and pmflush, you put them together, and they produce output in one of three places β an xconfirm(1) window, the standard error stream, or a file β and they do it in a manner similar to fprintf(3). iconic behaviour honestly.
the fmt argument is the one calling the shots for the conversion, formatting, and printing of the variable length args list. and which of those three output techniques you get? that's controlled via an environment variable, iykyk. π
pmprintf appends the formatted message string to an internal buffer shared by the two routines, and it does not actually produce any output yet. it's just queueing the vibes. π
pmflush is the main character moment: it causes the internal buffer to be either displayed in a window, printed on standard error, or flushed to a file β and then the internal buffer gets cleared. periodt. π
π DIAGNOSTICS π
on successful completion, pmprintf returns the number of characters transmitted, while pmflush returns a value of zero on successful completion.
for either routine, a negative value is returned if an error was encountered β and bestie you can pass that straight to pmErrStr(3) to obtain the associated error message. handy fr fr. π
π FILES π
pmprintf uses the mkstemp(3) function to create a temporary file. that temporary file is deleted when pmflush is called. so clean, so tidy, we love a routine that cleans up after itself. β¨
π ENVIRONMENT π
the environment variable PCP_STDERR controls the output technique used by pmflush:
- if
PCP_STDERRis unset, the text is written onto thestderrstream of the caller. - if
PCP_STDERRis set to the literal reserved wordDISPLAY, then the text will be displayed as a GUI dialog usingxconfirm(1). ooooh fancy π¦ - if
PCP_STDERRis set to any other value, thenpmflushinterprets the value as a file name and appends the text to that file. the file is created if it doesn't already exist, and in this case if the file creation fails, thenstderris used instead. (that parenthetical energy, but make it a real fallback π)
π SEE ALSO π
pmdbg(1), fprintf(3), mkstemp(3), pmErrStr(3) and PMAPI(3).
and that's the whole page, bestie!! π this came to you straight from the Performance Co-Pilot corner of the universe, PCP edition, filed under PMPRINTF(3). go forth and format responsibly. mwah π«ΆππΈ
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms