wcsrtombs(3) Library Functions Manual wcsrtombs(3)

wcsrtombs - convierte una cadena de caracteres anchos a una cadena multibyte

Biblioteca Estándar C (libc-lc)

#include <wchar.h>
size_t wcsrtombs(char dest[restrict .size], const wchar_t **restrict src,
                 size_t size, mbstate_t *restrict ps);

If dest is not NULL, the wcsrtombs() function converts the wide-character string *src to a multibyte string starting at dest. At most size bytes are written to dest. The shift state *ps is updated. The conversion is effectively performed by repeatedly calling wcrtomb(dest, *src, ps), as long as this call succeeds, and then incrementing dest by the number of bytes written and *src by one. The conversion can stop for three reasons:

Se ha encontrado un carácter ancho que no se puede representar como una secuencia multibyte (de acuerdo con la localización actual). En este caso, *src se deja apuntando al carácter ancho inválido, se devuelve (size_t) -1 y errno toma el valor EILSEQ.
The size limit forces a stop. In this case, *src is left pointing to the next wide character to be converted, and the number of bytes written to dest is returned.
The wide-character string has been completely converted, including the terminating null wide character (L'\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 bytes written to dest, excluding the terminating null byte ('\0'), is returned.

If dest is NULL, size is ignored, and the conversion proceeds as above, except that the converted bytes are not written out to memory, and that no size limit exists.

En los dos casos anteriores, si ps es un puntero NULL se usa en su lugar un estado estático anónimo sólo conocido por la función wcsrtombs().

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

La función wcsrtombs() devuelve el número de bytes que conforman la parte de la secuencia multibyte convertida, sin incluir el byte nulo terminador. Si encontró un carácter ancho que no pudo convertir, devuelve (size_t) -1 y errno toma el valor EILSEQ.

Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

Interfaz Atributo Valor
wcsrtombs() Seguridad del hilo MT-Carrera insegura:wcsrtombs/!ps

C11, POSIX.1-2008.

POSIX.1-2001, C99.

El comportamiento de wcsrtombs() 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.

iconv(3), mbsinit(3), wcrtomb(3), wcsnrtombs(3), wcstombs(3)

La traducción al español de esta página del manual fue creada por Pedro Pablo Fábrega <pfabrega@arrakis.es> y Juan Piernas <piernas@ditec.um.es>

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