mbtowc(3) Library Functions Manual mbtowc(3) mbtowc - LIBRARY Standard C library (libc, -lc) #include int mbtowc(wchar_t *restrict pwc, const char s[restrict .n], size_t n); The main case for this function is when s is not NULL and pwc is not NULL. In this case, the mbtowc() function inspects at most n bytes of the multibyte string starting at s, extracts the next complete multibyte character, converts it to a wide character and stores it at *pwc. It updates an internal shift state known only to the mbtowc() function. If s does not point to a null byte ('\0'), it returns the number of bytes that were consumed from s, otherwise it returns 0. n , s, , mbtowc() -1. n >= MB_CUR_MAX, . , s NULL, pwc NULL. mbtowc() , . , s NULL. pwc n . mbtowc() , , , , , . s NULL, mbtowc() , s, 0, s null, -1 -- . s NULL, mbtowc() , , , . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |mbtowc() | | MT-Unsafe race | +----------------------------+----------------------------------------------------------+--------------------------+ . mbrtowc(3) . C11, POSIX.1-2008. POSIX.1-2001, C99. mbtowc() LC_CTYPE . . MB_CUR_MAX(3), mblen(3), mbrtowc(3), mbstowcs(3), wcstombs(3), wctomb(3) aereiae , Alexey , Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , ITriskTI , Max Is , Yuri Kozlov , ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . mbtowc(3)