Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mbtowc(3int) — Ultrix/UWS 4.1 RISC

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mblen(3int)

mbstowcs(3int)

setlocale(3int)

wctomb(3int)

wcstombs(3int)

mbtowc(3int)

Name

mbtowc − converts a single multibyte character into a character of type wchar_t

Syntax

#include <stdlib.h>

int mbtowc (pwc, s, n)
wchar_t *pwc;
const char *s;
size_t n;

Arguments

pwc The pwc argument is a pointer to the resulting object of type wchar_t. 

s The s argument is a pointer to a multibyte character. 

n The n argument is the maximum number of bytes of object s that are examined. 

Description

If s is not a null pointer, the mbtowc function determines the number of bytes that comprise the multibyte character pointed to by s.  It then determines the character code for the value (of type wchar_t) that corresponds to that multibyte character (the value of the code corresponding to the null character is zero). If the multibyte character is valid and pwc is not a null pointer, the mbtowc function stores the code in the object pointed to by pwc.  At most n bytes of the array pointed to by s are examined.  This function is affected by the LC_CTYPE category of the current locale. 

Return Values

If s is a null pointer, the mbtowc function returns a zero value. If s is not a null pointer, the mbtowc function returns:

•0, if s points to the null character

•The number of bytes that comprise the converted multibye character, if the next n or fewer bytes form a valid multibye character

•- -1, if the next n or fewer bytes do not form a valid multibye character

In no case is the value returned greater than n or the value of the MB_CUR_MAX macro. 

See Also

mblen(3int), mbstowcs(3int), setlocale(3int), wctomb(3int), wcstombs(3int)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026