NAME
mbtowc - convert a multibyte sequence to a wide character
SYNOPSIS
#include <stdlib.h> int mbtowc(wchar_t *pwc, const char *s, size_t n);
DESCRIPTION
The main case for this function is when s is not NULL and pwc is not NULL. In this case, the mbtowc() 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 an internal shift state known only to the mbtowc() function. If s does not point to a null byte ('\0'), it returns the number of bytes that were consumed from s, otherwise it returns 0. If the n bytes starting at s do not contain a complete multibyte character, or if they contain an invalid multibyte sequence, mbtowc() returns -1. This can happen even if n >= MB_CUR_MAX, if the multibyte string contains redundant shift sequences. A different case is when s is not NULL but pwc is NULL. In this case, the mbtowc() function behaves as above, except that it does not store the converted wide character in memory. A third case is when s is NULL. In this case, pwc and n are ignored. The mbtowc() function resets the shift state, only known to this function, to the initial state, and returns nonzero if the encoding has nontrivial shift state, or zero if the encoding is stateless.
RETURN VALUE
If s is not NULL, the mbtowc() function returns the number of consumed bytes starting at s, or 0 if s points to a null byte, or -1 upon failure. If s is NULL, the mbtowc() function returns nonzero if the encoding has nontrivial shift state, or zero if the encoding is stateless.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). Interface Attribute Value mbtowc() Thread safety MT-Unsafe race
CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C99.
NOTES
The behavior of mbtowc() depends on the LC_CTYPE category of the current locale. This function is not multithread safe. The function mbrtowc(3) provides a better interface to the same functionality.
SEE ALSO
MB_CUR_MAX(3), mblen(3), mbrtowc(3), mbstowcs(3), wcstombs(3), wctomb(3)
COLOPHON
This page is part of release 4.09 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
More Linux Commands
manpages/pcre32_free_study.3.html
pcre32_free_study(3) Perl-compatible regular expressions....
This function is used to free the memory used for the data generated by a call to pcre[16|32]_study() when it is no longer needed. The argument must be the resu
manpages/Tk_Y.3.html
Tk_Y(3) - retrieve information from Tk's local data structur
Tk_WindowId and the other names listed above are all macros that return fields from Tks local data structure for tkwin. None of these macros requires any intera
manpages/ether_aton_r.3.html
ether_aton_r(3) - Ethernet address manipulation routines....
ether_aton() converts the 48-bit Ethernet host address asc from the standard hex-digits-and-colons notation into binary data in network byte order and returns a
manpages/ppmrainbow.1.html
ppmrainbow(1) - Generate a rainbow - Linux manual page......
This program is part of Netpbm(1) ppmrainbow generates a PPM image that fades from one color to another to another from left to right, like a rainbow. The color
manpages/glutChangeToSubMenu.3.html
glutChangeToSubMenu(3) - changes the specified menu item in
glutChangeToSubMenu changes the specified menu item in the current menu into a sub-menu trigger. The entry parameter determines which menu item should be change
manpages/mvderwin.3ncurses.html
mvderwin(3ncurses) - create curses windows - Linux man page
Calling newwin creates and returns a pointer to a new window with the given number of lines and columns. The upper left-hand corner of the window is at line beg
manpages/curl_multi_info_read.3.html
curl_multi_info_read(3) - read multi stack informationals...
Ask the multi handle if there are any messages/informationals from the individual transfers. Messages may include informationals such as an error code from the
manpages/pthread_attr_getstack.3.html
pthread_attr_getstack(3) - set/get stack attributes in threa
The pthread_attr_setstack() function sets the stack address and stack size attributes of the thread attributes object referred to by attr to the values specifie
manpages/spacing.3menu.html
spacing(3menu) - Control spacing between menu items.........
The function set_menu_spacing sets the spacing information for the menu. Its parameter spc_description controls the number of spaces between an item name and an
manpages/mk_cmds.1.html
mk_cmds(1) - error table compiler - Linux manual page.......
Mk_cmds converts a table listing command names and associated help messages into a C source file suitable for use with the ss(3) library. The source file name m
manpages/htnotify.1.html
htnotify(1) - sends email notifications about out-dated web
Htnotify scans the document database created by htmerge and sends an email message for every page that is out of date. Please have a look at the ht://Dig notifi
manpages/fop-fontmetric.1.html
fop-fontmetric(1) - Reads TTF files and Generates Appropriat
xmlgraphics-fop-fontmetric Reads TTF files and Generates Appropriate Font Classnames: org.apache.fop.fonts.apps.PFMReader and org.apache.fop.fonts.apps.TT....
