mbsnrtowcs(3) Library Functions Manual mbsnrtowcs(3) mbsnrtowcs - C (libc, -lc) #include size_t mbsnrtowcs(size_t size; wchar_t dest[restrict size], const char **restrict src, size_t nms, size_t size, mbstate_t *restrict ps); glibc (. feature_test_macros(7)): mbsnrtowcs(): glibc 2.10: _POSIX_C_SOURCE >= 200809L glibc 2.10: _BSD_SOURCE mbsnrtowcs() mbsrtowcs(3), , , *src, nms . If dest is not NULL, the mbsnrtowcs() function converts at most nms bytes from the multibyte string *src to a wide-character string starting at dest. At most size wide characters are written to dest. The shift state *ps is updated. The conversion is effectively performed by repeatedly calling mbrtowc(dest, *src, n, ps) where n is some positive number, as long as this call succeeds, and then incrementing dest by one and *src by the number of bytes consumed. The conversion can stop for three reasons: o . *src - , (size_t) -1 errno EILSEQ. o The nms limit forces a stop, or size non-L'\0' wide characters have been stored at dest. In this case, *src is left pointing to the next multibyte sequence to be converted, and the number of wide characters written to dest is returned. o The multibyte string has been completely converted, including the terminating null wide character ('\0') (which has the side effect of bringing back *ps to the initial state). In this case, *src is set to NULL, and the number of wide characters written to dest, excluding the terminating null wide character, is returned. , POSIX.1 -- ( ) . glibc . If dest is NULL, size is ignored, and the conversion proceeds as above, except that the converted wide characters are not written out to memory, and that no destination size limit exists. , ps NULL, , mbsnrtowcs(). The programmer must ensure that there is room for at least size wide characters at dest. mbsnrtowcs() , , null. , (size_t) -1, errno EILSEQ. attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |mbsnrtowcs() | | MT-Unsafe | | | | race:mbsnrtowcs/!ps | +----------------------------+----------------------------------------------------------+--------------------------+ POSIX.1-2008. mbsnrtowcs() LC_CTYPE . NULL ps . iconv(3), mbrtowc(3), mbsinit(3), mbsrtowcs(3) () aereiae , Alexey , Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , ITriskTI , Max Is , Yuri Kozlov , ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.17 8 2026 . mbsnrtowcs(3)