mbstowcs man page on BSDOS

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDOS logo
[printable version]

MULTIBYTE(3)		    BSD Programmer's Manual		  MULTIBYTE(3)

NAME
     mblen, mbstowcs, mbtowc, wcstombs, wctomb - multibyte character support
     for C

SYNOPSIS
     #include <stdlib.h>

     int
     mblen(const char *mbchar, int nbytes);

     size_t
     mbstowcs(wchar_t *wcstring, const char *mbstring, size_t nwchars);

     int
     mbtowc(wchar_t *wcharp, const char *mbchar, size_t nbytes);

     size_t
     wcstombs(char *mbstring, const wchar_t *wcstring, size_t nbytes);

     int
     wctomb(char *mbchar, wchar_t wchar);

DESCRIPTION
     The basic elements of some written natural languages such as Chinese can-
     not be represented uniquely with single C chars. The C standard supports
     two different ways of dealing with extended natural language encodings,
     wide characters and multibyte characters.	Wide characters are an inter-
     nal representation which allows each basic element to map to a single ob-
     ject of type wchar_t. Multibyte characters are used for input and output
     and code each basic element as a sequence of C chars. Individual basic
     elements may map into one or more (up to MB_CHAR_MAX) bytes in a multi-
     byte character.

     The current locale (setlocale(3))	governs the interpretation of wide and
     multibyte characters.  The locale category LC_CTYPE specifically controls
     this interpretation.  The wchar_t type is wide enough to hold the largest
     value in the wide character representations for all locales.

     Multibyte strings may contain `shift' indicators to switch to and from
     particular modes within the given representation.	If explicit bytes are
     used to signal shifting, these are not recognized as separate characters
     but are lumped with a neighboring character.  There is always a distin-
     guished `initial' shift state.  The mbstowcs() and wcstombs() functions
     assume that multibyte strings are interpreted starting from the initial
     shift state.  The mblen(), mbtowc() and wctomb() functions maintain stat-
     ic shift state internally.	 A call with a null mbchar pointer returns
     nonzero if the current locale requires shift states, zero otherwise; if
     shift states are required, the shift state is reset to the initial state.
     The internal shift states are undefined after a call to setlocale() with
     the LC_CTYPE or LC_ALL categories.

     For convenience in processing, the wide character with value 0 (the null
     wide character) is recognized as the wide character string terminator,
     and the character with value 0 (the null byte) is recognized as the
     multibyte character string terminator.  Null bytes are not permitted
     within multibyte characters.

     The mblen() function computes the length in bytes of a multibyte charac-
     ter mbchar. Up to nbytes bytes are examined.

     The mbtowc() function converts a multibyte character mbchar into a wide
     character and stores the result in the object pointed to by wcharp. Up to
     nbytes bytes are examined.

     The wctomb() function converts a wide character wchar into a multibyte
     character and stores the result in mbchar. The object pointed to by
     mbchar must be large enough to accommodate the multibyte character.

     The mbstowcs() function converts a multibyte character string mbstring
     into a wide character string wcstring. No more than nwchars wide charac-
     ters are stored.  A terminating null wide character is appended if there
     is room.

     The wcstombs() function converts a wide character string wcstring into a
     multibyte character string mbstring. Up to nbytes bytes are stored in
     mbstring. Partial multibyte characters at the end of the string are not
     stored.  The multibyte character string is null terminated if there is
     room.

RETURN VALUES
     If multibyte characters are not supported in the current locale, all of
     these functions will return -1 if characters can be processed, otherwise
     0.

     If mbchar is NULL, the mblen(), mbtowc() and wctomb() functions return
     nonzero if shift states are supported, zero otherwise.  If mbchar is
     valid, then these functions return the number of bytes processed in
     mbchar, or -1 if no multibyte character could be recognized or converted.

     The mbstowcs() function returns the number of wide characters converted,
     not counting any terminating null wide character.	The wcstombs() func-
     tion returns the number of bytes converted, not counting any terminating
     null byte.	 If any invalid multibyte characters are encountered, both
     functions return -1.

SEE ALSO
     euc(4),  mbrune(3),  rune(3),  setlocale(3),  utf8(4)

STANDARDS
     The mblen(), mbstowcs(), mbtowc(), wcstombs() and wctomb() functions con-
     form to ANSI C X3.159-1989 (``ANSI C '').

BUGS
     The current implementation does not support shift states.

BSDI BSD/OS			 June 4, 1993				     2
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server BSDOS

List of man pages available for BSDOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net