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 MBSTOWCS 3 2011-09-28 "GNU" "Linux Programmer's Manual"
18 mbstowcs \- convert a multibyte string to a wide-character string
21 .B #include <stdlib.h>
23 .BI "size_t mbstowcs(wchar_t *" dest ", const char *" src ", size_t " n );
28 is not a NULL pointer,
34 to a wide-character string starting at
38 wide characters are written to
42 The conversion can stop for three reasons:
44 An invalid multibyte sequence has been encountered.
50 non-L\(aq\\0\(aq wide characters have been stored at
53 case the number of wide characters written to
56 shift state at this point is lost.
58 The multibyte string has been completely converted, including the
59 terminating null wide character (\(aq\\0\(aq).
60 In this case the number of wide characters written to
62 excluding the terminating null wide character, is returned.
64 The programmer must ensure that there is room for at least
74 is ignored, and the conversion proceeds as
75 above, except that the converted wide characters are not written out to memory,
76 and that no length limit exists.
78 In order to avoid the case 2 above, the programmer should make sure
82 .IR "mbstowcs(NULL,src,0)+1" .
86 function returns the number of wide characters that make
87 up the converted part of the wide-character string, not including the
88 terminating null wide character.
89 If an invalid multibyte sequence was
105 provides a better interface to the same