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 2011-09-28 "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).
59 the character array pointed to by
61 the shift sequence needed to
64 back to the initial state,
65 followed by a \(aq\\0\(aq byte.
66 It updates the shift state
69 it into the initial state),
70 and returns the length of the shift sequence plus
71 one, that is, the number of bytes written at
80 and the function effectively returns
82 wcrtomb(buf, L\(aq\\0\(aq, ps)
86 is an internal anonymous buffer.
88 In all of the above cases, if
90 is a NULL pointer, a static anonymous
91 state known only to the
93 function is used instead.
97 function returns the number of
98 bytes that have been or would
99 have been written to the byte array at
104 represented as a multibyte sequence (according to the current locale),
122 is not multithread safe.