mbsnrtowcs(3) | Library Functions Manual | mbsnrtowcs(3) |
NOMBRE
mbsnrtowcs - convierte una cadena multibyte a una cadena de caracteres anchos
BIBLIOTECA
Biblioteca Estándar C (libc, -lc)
SINOPSIS
#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);
mbsnrtowcs():
Desde glibc 2.10: _POSIX_C_SOURCE >= 200809L Antes de glibc 2.10: _GNU_SOURCE
DESCRIPCIÓN
La función mbsnrtowcs() es como la función mbsrtowcs(3), salvo que el número de bytes a convertir, comenzando en *src, está limitado a 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:
- •
- Se ha encontrado una secuencia multibyte inválida. En este caso se deja *src apuntando a la secuencia multibyte inválida, la función devuelve (size_t) -1 y se asigna a errno el valor 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.
According to POSIX.1, if the input buffer ends with an incomplete character, it is unspecified whether conversion stops at the end of the previous character (if any), or at the end of the input buffer. The glibc implementation adopts the former behavior.
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.
En los dos casos anteriores, si ps es un puntero NULL, en su lugar se usa un estado anónimo privado, sólo conocido por la función mbsnrtowcs().
The programmer must ensure that there is room for at least size wide characters at dest.
VALOR DEVUELTO
The mbsnrtowcs() function returns the number of wide characters that make up the converted part of the wide-character string, not including the terminating null wide character. If an invalid multibyte sequence was encountered, (size_t) -1 is returned, and errno set to EILSEQ.
ATRIBUTOS
Para obtener una explicación de los términos usados en esta sección, véase attributes(7).
Interfaz | Atributo | Valor |
mbsnrtowcs() | Seguridad del hilo | MT-Unsafe race:mbsnrtowcs/!ps |
ESTÁNDARES
POSIX.1-2008.
NOTAS
El comportamiento de mbsnrtowcs() depende de la categoría LC_CTYPE de la localización actual.
Pasar NULL como valor de ps no es seguro en un entorno multihilos.
VÉASE TAMBIÉN
TRADUCCIÓN
La traducción al español de esta página del manual fue creada por Juan Piernas <piernas@ditec.um.es> y Marcos Fouces <marcos@debian.org>
Esta traducción es documentación libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD.
Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a debian-l10n-spanish@lists.debian.org.
17 Noviembre 2024 | Páginas de Manual de Linux 6.12 |