From: Alejandro Colomar <alx.manpages@gmail.com>
To: linux-man@vger.kernel.org
Cc: Alejandro Colomar <alx@kernel.org>,
Ian Abbott <abbotti@mev.co.uk>, Zack Weinberg <zack@owlfolio.org>
Subject: Re: [PATCH] scanf.3, sscanf.3, vsscanf.3: Split the page, one for strings and one for FILEs
Date: Thu, 29 Dec 2022 12:37:46 +0100 [thread overview]
Message-ID: <a927c23d-aca7-ddfc-9f64-cca0f36fff04@gmail.com> (raw)
In-Reply-To: <20221229112635.4684-1-alx@kernel.org>
[-- Attachment #1.1: Type: text/plain, Size: 3925 bytes --]
scanf(3) Library Functions Manual scanf(3)
NAME
scanf, fscanf, vscanf, vfscanf - input FILE format conversion
LIBRARY
Standard C library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int scanf(const char *restrict format, ...);
int fscanf(FILE *restrict stream,
const char *restrict format, ...);
#include <stdarg.h>
int vscanf(const char *restrict format, va_list ap);
int vfscanf(FILE *restrict stream,
const char *restrict format, va_list ap);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
vscanf(), vfscanf():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
DESCRIPTION
The scanf() family of functions scans input like sscanf(3), but read
from a FILE. It is very difficult to use these functions correctly,
and it is preferable to read entire lines with fgets(3) or getline(3)
and parse them later with sscanf(3) or more specialized functions such
as strtol(3).
The scanf() function reads input from the standard input stream stdin
and fscanf() reads input from the stream pointer stream.
The vfscanf() function is analogous to vfprintf(3) and reads input from
the stream pointer stream using a variable argument list of pointers
(see stdarg(3). The vscanf() function is analogous to vprintf(3) and
reads from the standard input.
RETURN VALUE
On success, these functions return the number of input items success‐
fully matched and assigned; this can be fewer than provided for, or
even zero, in the event of an early matching failure.
The value EOF is returned if the end of input is reached before either
the first successful conversion or a matching failure occurs. EOF is
also returned if a read error occurs, in which case the error indicator
for the stream (see ferror(3)) is set, and errno is set to indicate the
error.
ERRORS
EAGAIN The file descriptor underlying stream is marked nonblocking, and
the read operation would block.
EBADF The file descriptor underlying stream is invalid, or not open
for reading.
EILSEQ Input byte sequence does not form a valid character.
EINTR The read operation was interrupted by a signal; see signal(7).
EINVAL Not enough arguments; or format is NULL.
ENOMEM Out of memory.
ATTRIBUTES
For an explanation of the terms used in this section, see attrib‐
utes(7).
┌─────────────────────────────────────┬───────────────┬────────────────┐
│Interface │ Attribute │ Value │
├─────────────────────────────────────┼───────────────┼────────────────┤
│scanf(), fscanf(), vscanf(), │ Thread safety │ MT‐Safe locale │
│vfscanf() │ │ │
└─────────────────────────────────────┴───────────────┴────────────────┘
STANDARDS
These functions conform to C99 and POSIX.1‐2001.
SEE ALSO
fgets(3), getline(3), sscanf(3)
Linux man‐pages (unreleased) (date) scanf(3)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-12-29 11:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-29 11:26 [PATCH] scanf.3, sscanf.3, vsscanf.3: Split the page, one for strings and one for FILEs Alejandro Colomar
2022-12-29 11:37 ` Alejandro Colomar [this message]
2022-12-29 11:38 ` Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a927c23d-aca7-ddfc-9f64-cca0f36fff04@gmail.com \
--to=alx.manpages@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=alx@kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=zack@owlfolio.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox