2 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\" References consulted:
7 .\" GNU glibc-2 source code and manual
8 .\" Dinkumware C library reference http://www.dinkumware.com/
9 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
12 .TH wcrtomb 3 (date) "Linux man-pages (unreleased)"
14 wcrtomb \- convert a wide character to a multibyte sequence
17 .RI ( libc ", " \-lc )
22 .BI "size_t wcrtomb(char *restrict " s ", wchar_t " wc \
23 ", mbstate_t *restrict " ps );
26 The main case for this function is when
31 is not a null wide character (L\[aq]\e0\[aq]).
35 converts the wide character
37 to its multibyte representation and stores it
38 at the beginning of the character
41 It updates the shift state
44 returns the length of said multibyte representation,
45 that is, the number of bytes
49 A different case is when
54 is a null wide character (L\[aq]\e0\[aq]).
58 the character array pointed to by
60 the shift sequence needed to
63 back to the initial state,
64 followed by a \[aq]\e0\[aq] byte.
65 It updates the shift state
68 it into the initial state),
69 and returns the length of the shift sequence plus
70 one, that is, the number of bytes written at
79 and the function effectively returns
83 wcrtomb(buf, L\[aq]\e0\[aq], ps)
89 is an internal anonymous buffer.
91 In all of the above cases, if
93 is NULL, a static anonymous
94 state known only to the
96 function is used instead.
100 function returns the number of
101 bytes that have been or would
102 have been written to the byte array at
107 represented as a multibyte sequence (according to the current locale),
114 For an explanation of the terms used in this section, see
120 Interface Attribute Value
125 T} Thread safety MT-Unsafe race:wcrtomb/!ps
142 is not multithread safe.