mbtowc(3) Library Functions Manual mbtowc(3) NOM mbtowc - Convertir une sequences multioctet en caracteres larges BIBLIOTHEQUE Bibliotheque C standard (libc, -lc) SYNOPSIS #include int mbtowc(size_t size; wchar_t *restrict pwc, const char s[restrict size], size_t size); DESCRIPTION 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 size 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. If the size bytes starting at s do not contain a complete multibyte character, or if they contain an invalid multibyte sequence, mbtowc() returns -1. This can happen even if size >= MB_CUR_MAX, if the multibyte string contains redundant shift sequences. Un autre cas possible se present si s est non NULL, mais pwc est NULL. Dans ce cas, la fonction mbtowc() se comporte comme ci-dessus, mais ne stocke par le caractere large en memoire. A third case is when s is NULL. In this case, pwc and size are ignored. The mbtowc() function resets the shift state, only known to this function, to the initial state, and returns nonzero if the encoding has nontrivial shift state, or zero if the encoding is stateless. VALEUR RENVOYEE Si s est non NULL, la fonction mbtowc() renvoie le nombre d'octets consommes a partir de s, ou zero si s pointe sur un octet nul, ou encore -1 en cas d'erreur. Si s est NULL, la fonction mbtowc() renvoie une valeur non nulle si l'encodage a un etat de decalage non trivial, ou zero si l'encodage est sans etat. ATTRIBUTS Pour une explication des termes utilises dans cette section, consulter attributes(7). +--------------------------+--------------------------+----------------+ |Interface | Attribut | Valeur | +--------------------------+--------------------------+----------------+ |mbtowc() | Securite des threads | MT-Unsafe race | +--------------------------+--------------------------+----------------+ VERSIONS Cette fonction n'est pas sure en contexte multithread. La fonction mbrtowc(3) fournit une meilleure interface pour la meme fonctionnalite. NORMES C11, POSIX.1-2008. HISTORIQUE POSIX.1-2001, C99. NOTES Le comportement de mbtowc() depend de la categorie LC_CTYPE de la localisation en cours. VOIR AUSSI MB_CUR_MAX(3), mblen(3), mbrtowc(3), mbstowcs(3), wcstombs(3), wctomb(3) TRADUCTION La traduction francaise de cette page de manuel a ete creee par Christophe Blaess , Stephan Rafin , Thierry Vignaud , Francois Micaux, Alain Portal , Jean-Philippe Guerard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas Francois , Florentin Duneau , Simon Paillard , Denis Barbier , David Prevot et Jean-Pierre Giraud Cette traduction est une documentation libre ; veuillez vous reporter a la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITE LEGALE. Si vous decouvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message a . Linux man-pages 6.18 8 fevrier 2026 mbtowc(3)