oracular (3) mbrtowc.3.gz

Provided by: manpages-es-dev_4.23.1-1_all bug

NOMBRE

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

BIBLIOTECA

       Biblioteca Estándar C (libc, -lc)

SINOPSIS

       #include <wchar.h>

       size_t mbrtowc(wchar_t *restrict pwc, const char s[restrict .n],
                      size_t n, mbstate_t *restrict ps);

DESCRIPCIÓN

       The  main  case for this function is when s is not NULL and pwc is not NULL.  In this case, the mbrtowc()
       function inspects at most n 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 the shift state
       *ps.  If the converted wide character is not L'\0' (the null wide character), it returns  the  number  of
       bytes that were consumed from s.  If the converted wide character is L'\0', it resets the shift state *ps
       to the initial state and returns 0.

       Si los n bytes que comienzan en s  no  contienen  un  carácter  multibyte  completo,  mbrtowc()  devuelve
       (size_t) -2. Esto puede ocurrir incluso si n >= MB_CUR_MAX, si la cadena multibyte contiene secuencias de
       cambios redundantes.

       Si la cadena multibyte que comienza en s contiene una secuencia multibyte inválida  antes  del  siguiente
       carácter  completo,  mbrtowc()  devuelve (size_t) -1 y asigna a errno el valor EILSEQ.  En este caso, los
       efectos sobre *ps son indefinidos.

       Un caso diferente se da cuando s no es NULL pero pwc es NULL. En  este  caso,  la  función  mbrtowc()  se
       comporta como antes, excepto que no almacena el carácter ancho obtenido en memoria.

       Un  tercer  caso  se  da  cuando  s es NULL. En este caso, pwc y n se ignoran. Si el estado de conversión
       representado por *ps indica una conversión incompleta  de  caracteres  multibyte,  la  función  mbrtowc()
       devuelve  (size_t) -1,  asigna a errno el valor EILSEQ, y deja *ps en un estado indefinido. En otro caso,
       la función mbrtowc() coloca *ps en el estado inicial y devuelve 0.

       In all of the above cases, if ps is NULL, a static anonymous state known only to the mbrtowc()   function
       is  used  instead.   Otherwise,  *ps  must  be  a  valid  mbstate_t object.  An mbstate_t object a can be
       initialized to the initial state by zeroing it, for example using

           memset(&a, 0, sizeof(a));

VALOR DEVUELTO

       The mbrtowc()  function returns the number of bytes parsed from the multibyte sequence starting at s,  if
       a  non-L'\0'  wide character was recognized.  It returns 0, if a L'\0' wide character was recognized.  It
       returns (size_t) -1 and sets errno to EILSEQ, if an  invalid  multibyte  sequence  was  encountered.   It
       returns  (size_t) -2  if  it  couldn't  parse  a  complete  multibyte character, meaning that n should be
       increased.

ATRIBUTOS

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

       ┌──────────────────────────────────────────────────────┬────────────────────┬────────────────────────────┐
       │InterfazAtributoValor                      │
       ├──────────────────────────────────────────────────────┼────────────────────┼────────────────────────────┤
       │mbrtowc()                                             │ Seguridad del hilo │ MT-Unsafe race:mbrtowc/!ps │
       └──────────────────────────────────────────────────────┴────────────────────┴────────────────────────────┘

ESTÁNDARES

       C11, POSIX.1-2008.

HISTORIAL

       POSIX.1-2001, C99.

NOTAS

       El comportamiento de mbrtowc() depende de la categoría LC_CTYPE de la localización actual.

VÉASE TAMBIÉN

       mbsinit(3), mbsrtowcs(3)

TRADUCCIÓN

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

       Esta  traducción  es   documentación   libre;   lea   la   GNU   General   Public   License   Version   3
       ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩  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⟩.