diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-12-09 13:35:19 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-12-09 13:35:33 +0100 |
commit | 239c4bdd83bb09293248b93a3a218efa2d4cf017 (patch) | |
tree | f702e9ea65fd2f36217baab6cffeab50f3df3b8e | |
parent | bb4dbdb82f141f6394984aced67d65810ec7f747 (diff) |
scanf.3: BUGS: It's impossible to know how many characters were consumed
Suggested-by: Zack Weinberg <zack@owlfolio.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man3/scanf.3 | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/man3/scanf.3 b/man3/scanf.3 index 63f9c6dfd..be335a597 100644 --- a/man3/scanf.3 +++ b/man3/scanf.3 @@ -144,6 +144,15 @@ like the standard input stream. .P These functions can't report errors after the last non-suppressed conversion specification. +.SH BUGS +It is impossible to accurately know +how many characters these functions have consumed from the input stream, +since they only report the number of successful conversions. +For example, +if the input is "123\en\ a", +.I scanf(\[dq]%d\ %d\[dq], &a, &b) +will consume the digits, the newline, and the space, but not the letter a. +This makes it difficult to recover from invalid input. .SH SEE ALSO .BR fgets (3), .BR getline (3), |