aboutsummaryrefslogtreecommitdiff
path: root/manual/stdio.texi
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-03-29 11:45:04 +0000
committerArjun Shankar <arjun@redhat.com>2021-03-30 20:40:39 +0200
commit4d8d70d30171d6f451339f574130eed4fe747b4b (patch)
treeafcb060068490a24096d182f051f3cd35ece9d25 /manual/stdio.texi
parent42624c7dc79e64e40e88cc16f33ea3ad16e925cb (diff)
downloadglibc-4d8d70d30171d6f451339f574130eed4fe747b4b.zip
glibc-4d8d70d30171d6f451339f574130eed4fe747b4b.tar.gz
glibc-4d8d70d30171d6f451339f574130eed4fe747b4b.tar.bz2
manual: clarify that scanf %n supports type modifiers
My initial reading of the %n documentation was that it didn't support type conversions, because it only mentioned int*. Corresponding man-pages patch: https://lore.kernel.org/linux-man/20210328215509.31666-1-hi@alyssa.is/ Reviewed-by: Arjun Shankar <arjun@redhat.com>
Diffstat (limited to 'manual/stdio.texi')
-rw-r--r--manual/stdio.texi11
1 files changed, 6 insertions, 5 deletions
diff --git a/manual/stdio.texi b/manual/stdio.texi
index c48e3e6..6ff1806 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -3620,10 +3620,10 @@ function (@pxref{Parsing of Integers}) with the appropriate value
The @samp{%X} conversion is identical to the @samp{%x} conversion. They
both permit either uppercase or lowercase letters to be used as digits.
-The default type of the corresponding argument for the @code{%d} and
-@code{%i} conversions is @code{int *}, and @code{unsigned int *} for the
-other integer conversions. You can use the following type modifiers to
-specify other sizes of integer:
+The default type of the corresponding argument for the @code{%d},
+@code{%i}, and @code{%n} conversions is @code{int *}, and
+@code{unsigned int *} for the other integer conversions. You can use
+the following type modifiers to specify other sizes of integer:
@table @samp
@item hh
@@ -3888,7 +3888,8 @@ The resulting pointer value is not guaranteed to be valid if it was not
originally written during the same program execution that reads it in.
The @samp{%n} conversion produces the number of characters read so far
-by this call. The corresponding argument should be of type @code{int *}.
+by this call. The corresponding argument should be of type @code{int *},
+unless a type modifier is in effect (@pxref{Numeric Input Conversions}).
This conversion works in the same way as the @samp{%n} conversion for
@code{printf}; see @ref{Other Output Conversions}, for an example.