summaryrefslogtreecommitdiffstats
path: root/man3/mbstowcs.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/mbstowcs.3')
-rw-r--r--man3/mbstowcs.343
1 files changed, 19 insertions, 24 deletions
diff --git a/man3/mbstowcs.3 b/man3/mbstowcs.3
index c66b9c2..6a0d655 100644
--- a/man3/mbstowcs.3
+++ b/man3/mbstowcs.3
@@ -10,7 +10,7 @@
.\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
.\" ISO/IEC 9899:1999
.\"
-.TH mbstowcs 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH mbstowcs 3 2023-11-14 "Linux man-pages 6.7"
.SH NAME
mbstowcs \- convert a multibyte string to a wide-character string
.SH LIBRARY
@@ -19,24 +19,22 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <stdlib.h>
-.PP
-.BI "size_t mbstowcs(wchar_t " dest "[restrict ." n "], \
+.P
+.BI "size_t mbstowcs(wchar_t " dest "[restrict ." dsize "], \
const char *restrict " src ,
-.BI " size_t " n );
+.BI " size_t " dsize );
.fi
.SH DESCRIPTION
If
.I dest
is not NULL,
-the
-.BR mbstowcs ()
-function converts the
+convert the
multibyte string
.I src
to a wide-character string starting at
.IR dest .
At most
-.I n
+.I dsize
wide characters are written to
.IR dest .
The sequence of characters in the string
@@ -49,7 +47,7 @@ In this case,
.I (size_t)\ \-1
is returned.
.IP \[bu]
-.I n
+.I dsize
non-L\[aq]\e0\[aq] wide characters have been stored at
.IR dest .
In this case, the number of wide characters written to
@@ -62,30 +60,28 @@ terminating null character (\[aq]\e0\[aq]).
In this case, the number of wide characters written to
.IR dest ,
excluding the terminating null wide character, is returned.
-.PP
-The programmer must ensure that there is room for at least
-.I n
-wide
-characters at
-.IR dest .
-.PP
+.P
If
.I dest
is NULL,
-.I n
+.I dsize
is ignored, and the conversion proceeds as
above, except that the converted wide characters are not written out to memory,
and that no length limit exists.
-.PP
+.P
In order to avoid the case 2 above, the programmer should make sure
-.I n
+.I dsize
is
greater than or equal to
.IR "mbstowcs(NULL,src,0)+1" .
+.P
+The programmer must ensure that there is room for at least
+.I dsize
+wide
+characters at
+.IR dest .
.SH RETURN VALUE
-The
-.BR mbstowcs ()
-function returns the number of wide characters that make
+The number of wide characters that make
up the converted part of the wide-character string, not including the
terminating null wide character.
If an invalid multibyte sequence was
@@ -106,7 +102,6 @@ T{
.BR mbstowcs ()
T} Thread safety MT-Safe
.TE
-.sp 1
.SH VERSIONS
The function
.BR mbsrtowcs (3)
@@ -128,7 +123,7 @@ The program below illustrates the use of
.BR mbstowcs (),
as well as some of the wide character classification functions.
An example run is the following:
-.PP
+.P
.in +4n
.EX
$ ./t_mbstowcs de_DE.UTF\-8 Grüße!