Scroll to navigation

wcrtomb(3) Library Functions Manual wcrtomb(3)

NOMBRE

wcrtomb - convierte una carácter ancho a un secuencia multibyte

BIBLIOTECA

Biblioteca Estándar C (libc, -lc)

SINOPSIS

#include <wchar.h>
size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict ps);

DESCRIPCIÓN

The main case for this function is when s is not NULL and wc is not a null wide character (L'\0'). In this case, the wcrtomb() function converts the wide character wc to its multibyte representation and stores it at the beginning of the character array pointed to by s. It updates the shift state *ps, and returns the length of said multibyte representation, that is, the number of bytes written at s.

A different case is when s is not NULL, but wc is a null wide character (L'\0'). In this case, the wcrtomb() function stores at the character array pointed to by s the shift sequence needed to bring *ps back to the initial state, followed by a '\0' byte. It updates the shift state *ps (i.e., brings it into the initial state), and returns the length of the shift sequence plus one, that is, the number of bytes written at s.

Un tercer caso es cuando s es NULL. En este caso wc se ignora, y la función devuelve efectivamente


wcrtomb(buf, L'\0', ps)

donde buf es un buffer anónimo interno.

En todos los 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 wcrtomb().

VALOR DEVUELTO

La función wcrtomb() devuelve el número de bytes que han sido o serían escritos en el array de bytes s. Si wc no se puede representar como un secuencia multibyte (de acuerdo a la localización actual), devuelve (size_t) -1 y errno se pone con el valor EILSEQ.

ATRIBUTOS

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

Interfaz Atributo Valor
wcrtomb() Seguridad del hilo MT-Unsafe race:wcrtomb/!ps

ESTÁNDARES

C11, POSIX.1-2008.

HISTORIAL

POSIX.1-2001, C99.

NOTAS

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

mbsinit(3), wcsrtombs(3)

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Pedro Pablo Fábrega <pfabrega@arrakis.es>, 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.

20 ​​Julio 2023 Páginas de manual de Linux 6.05.01