Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


pmfstring(3) — Linux manual page

NAME |C SYNOPSIS |DESCRIPTION |COMPATIBILITY |SEE ALSO |COLOPHON

PMFSTRING(3)             Library Functions ManualPMFSTRING(3)

NAME        top

pmfstring- safe string scanning

C SYNOPSIS        top

#include <pcp/pmapi.h>ssize_t pmfstring(FILE *f, char **str);cc ... -lpcp

DESCRIPTION        top

pmfstringis a safe string scanning routine with semantics similar       tofscanf(3)  with  the%sformat specifier.  It scans the input       stream fromf skipping initial whitespace characters, then accumu‐       lating all the subsequent non-whitespace characters.       The main difference is thatpmfstringallocates the result  bufferstr  using  themalloc(3) family and ensures thatstr is (a) large       enough and (b) null-byte terminated.       Additionallypmfstringdoes not consider \n  to  be  a  whitespace       character in the initial scan (before fillingstr) and so will not       scan  past  the  end  of  the  current line, which is different tofscanf(3) and better aligned with the PCP use cases.       The caller is responsible for maintaining a reference  tostr  or       callingfree(3) to release the associated storage.       On  success,pmfstringreturns the length ofstr (the same length       asstrlen(3) would return) that is guaranteed to be not less  than       1.       Failure  is  indicated by one of the following, andstr is not as‐       signed a value:        • 0 to indicate no non-whitespace characters were found before          the end of the current line from the streamf        • -1 ( akaEOF) to indicate end of file on the streamf        • -2 to indicate some more serious failure, probably in themalloc(3) routines; refer toerrno for more information

COMPATIBILITY        top

pmfstringhas similar semantics to the%msformat specifier in       some versions offscanf(3) and the C99fscanf_s(3) routine - un‐       fortunately neither of these is portable.

SEE ALSO        top

free(3),fscanf(3),malloc(3) andstrlen(3).

COLOPHON        top

       This page is part of thePCP (Performance Co-Pilot) project.  In‐       formation about the project can be found at ⟨http://www.pcp.io/⟩.       If you have a bug report for this manual page, send it to       pcp@groups.io.  This page was obtained from the project's upstream       Git repository ⟨https://github.com/performancecopilot/pcp.git⟩ on       2025-08-11.  (At that time, the date of the most recent commit       that was found in the repository was 2025-08-11.)  If you discover       any rendering problems in this HTML version of the page, or you       believe there is a better or more up-to-date source for the page,       or you have corrections or improvements to the information in this       COLOPHON (which isnot part of the original manual page), send a       mail to man-pages@man7.orgPerformance Co-Pilot               PCPPMFSTRING(3)


HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp