- Merge the remaining portion of the wlan-bringup branch
[reactos.git] / reactos / lib / sdk / crt / stdlib / mbstowcs.c
1 #include <precomp.h>
2
3
4 /*
5 * @implemented
6 */
7 size_t mbstowcs (wchar_t *widechar, const char *multibyte, size_t number)
8 {
9 int bytes;
10 size_t n = 0;
11
12 while (n < number) {
13
14 if ((bytes = mbtowc (widechar, multibyte, MB_LEN_MAX)) < 0)
15 return (size_t) -1;
16
17 if (bytes == 0) {
18 *widechar = (wchar_t) '\0';
19 return n;
20 }
21
22 widechar++;
23 multibyte += bytes;
24 n++;
25 }
26
27 return n;
28 }