From 239c4bdd83bb09293248b93a3a218efa2d4cf017 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 9 Dec 2023 13:35:19 +0100 Subject: scanf.3: BUGS: It's impossible to know how many characters were consumed Suggested-by: Zack Weinberg Signed-off-by: Alejandro Colomar --- man3/scanf.3 | 9 +++++++++ 1 file changed, 9 insertions(+) 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), -- cgit v1.2.3