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 WCSTOMBS 3 2014-03-18 "GNU" "Linux Programmer's Manual"
18 wcstombs \- convert a wide-character string to a multibyte string
21 .B #include <stdlib.h>
23 .BI "size_t wcstombs(char *" dest ", const wchar_t *" src ", size_t " n );
31 the wide-character string
33 to a multibyte string starting at
40 starts in the initial state.
41 The conversion can stop for three reasons:
43 1. A wide character has been encountered that can not be represented as a
44 multibyte sequence (according to the current locale).
49 2. The length limit forces a stop.
50 In this case, the number of bytes written to
52 is returned, but the shift state at this point is lost.
54 3. The wide-character string has been completely converted, including the
55 terminating null wide character (L\(aq\\0\(aq).
56 In this case, the conversion ends in the initial state.
57 The number of bytes written to
59 excluding the terminating null byte (\(aq\\0\(aq), is returned.
61 The programmer must ensure that there is room for at least
71 is ignored, and the conversion proceeds as
72 above, except that the converted bytes are not written out to memory,
73 and no length limit exists.
75 In order to avoid the case 2 above, the programmer should make sure
77 is greater than or equal to
78 .IR "wcstombs(NULL,src,0)+1" .
82 function returns the number of bytes that make up the
83 converted part of a multibyte sequence,
84 not including the terminating null byte.
85 If a wide character was encountered which could not be
101 provides a thread safe interface to
102 the same functionality.
110 This page is part of release 3.79 of the Linux
113 A description of the project,
114 information about reporting bugs,
115 and the latest version of this page,
117 \%http://www.kernel.org/doc/man\-pages/.