1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
10 .\" References consulted:
11 .\" GNU glibc-2 source code and manual
12 .\" Dinkumware C library reference http://www.dinkumware.com/
13 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
16 .TH WCRTOMB 3 2017-09-15 "GNU" "Linux Programmer's Manual"
18 wcrtomb \- convert a wide character to a multibyte sequence
23 .BI "size_t wcrtomb(char *" s ", wchar_t " wc ", mbstate_t *" ps );
26 The main case for this function is when
31 is not a null wide character (L\(aq\\0\(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\\0\(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\\0\(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
81 wcrtomb(buf, L\(aq\\0\(aq, ps)
85 is an internal anonymous buffer.
87 In all of the above cases, if
89 is NULL, a static anonymous
90 state known only to the
92 function is used instead.
96 function returns the number of
97 bytes that have been or would
98 have been written to the byte array at
103 represented as a multibyte sequence (according to the current locale),
110 For an explanation of the terms used in this section, see
116 Interface Attribute Value
119 T} Thread safety MT-Unsafe race:wcrtomb/!ps
123 POSIX.1-2001, POSIX.1-2008, C99.
134 is not multithread safe.