mbsnrtowcs(3) Library Functions Manual mbsnrtowcs(3)

mbsnrtowcs - Convertir une séquence multioctet en chaîne de caractères larges

Bibliothèque C standard (libc-lc)

#include <wchar.h>
size_t mbsnrtowcs(wchar_t dest[restrict .size], const char **restrict src,
                  size_t nms, size_t size, mbstate_t *restrict ps);
Exigences de macros de test de fonctionnalités pour la glibc (consulter feature_test_macros(7)) :

mbsnrtowcs() :

    Depuis la glibc 2.10 :
        _POSIX_C_SOURCE >= 200809L
    Avant la glibc 2.10 :
        _GNU_SOURCE

La fonction mbsnrtowcs() est équivalente à la fonction mbsrtowcs(3), sauf qu'elle ne convertit qu'un nombre limité à au plus nms octets commençant en *src.

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:

  • Une séquence multioctet incorrecte a été rencontrée. Dans ce cas, *src pointera sur la séquence incorrecte, et la fonction renvoie (size_t) -1 en positionnant errno à la valeur EILSEQ.
  • 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.
  • 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.

Selon POSIX.1, si le tampon d'entrée se termine par un caractère incomplet, il n'est pas spécifié si la conversion s'arrête à la fin du caractère précédant (s'il existe) ou à la fin du tampon d'entrée. L'implémentation de la glibc suit le premier comportement.

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.

Dans tous les cas, si ps est un pointeur NULL, un état anonyme statique, réservé à la fonction mbsnrtowcs() est utilisé à sa place.

The programmer must ensure that there is room for at least size wide characters at dest.

La fonction mbsnrtowcs() renvoie le nombre de caractères larges placés dans la zone convertie, sans compter le caractère nul final. Si une séquence multioctet incorrecte est rencontrée, la fonction renvoie (size_t) -1, et errno contient EILSEQ.

Pour une explication des termes utilisés dans cette section, consulter attributes(7).

Interface Attribut Valeur
mbsnrtowcs() Sécurité des threads MT-Unsafe race:mbsnrtowcs/!ps

POSIX.1-2008.

Le comportement de mbsnrtowcs() dépend de la catégorie LC_CTYPE de la localisation en cours.

Passer NULL dans ps n'est pas sûr dans un contexte multithread.

iconv(3), mbrtowc(3), mbsinit(3), mbsrtowcs(3)

La traduction française de cette page de manuel a été créée par Christophe Blaess https://www.blaess.fr/christophe/, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr> et Grégoire Scano <gregoire.scano@malloc.fr>

Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à debian-l10n-french@lists.debian.org.

17 novembre 2024 Pages du manuel de Linux 6.12