cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : C Library : cstdlib (stdlib.h) : mbstowcs
 
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
C Library
cassert (assert.h)
cctype (ctype.h)
cerrno (errno.h)
cfloat (float.h)
climits (limits.h)
clocale (locale.h)
cmath (math.h)
csetjmp (setjmp.h)
csignal (signal.h)
cstdarg (stdarg.h)
cstddef (stddef.h)
cstdio (stdio.h)
cstdlib (stdlib.h)
cstring (string.h)
ctime (time.h)
cstdlib (stdlib.h)
functions:
· abort
· abs
· atexit
· atof
· atoi
· atol
· bsearch
· calloc
· div
· exit
· free
· getenv
· labs
· ldiv
· malloc
· mblen
· mbstowcs
· mbtowc
· qsort
· rand
· realloc
· srand
· strtod
· strtol
· strtoul
· system
· wcstombs
· wctomb
functions (non-standard):
· itoa
macros:
· EXIT_FAILURE
· EXIT_SUCCESS
· MB_CUR_MAX
· NULL
· RAND_MAX
types:
· div_t
· ldiv_t
· size_t

-

mbstowcs function
size_t mbstowcs ( wchar_t * wcstr, const char * mbstr, size_t max );
<cstdlib>

Convert multibyte string to wide-character string

The C multibyte character string mbstr is interpreted character by character and translated to its wchar_t equivalent, which is stored in the location pointed by wcstr. The length in characters of the resulting string, not including the ending null-character, is returned.

Parameters

wcstr
Pointer to an array of wchar_t elements long enough to store a wide string max characters long.
mbstr
C multibyte character string to be interpreted.
max
Maximum number of wchar_t characters to be interpreted.

Return Value

The number of characters translated, not including the ending null-character.
If an invalid multibyte character is encountered, a -1 value is returned.

See also

mblen Get length of multibyte character (function)
mbtowc Convert multibyte character to wide character (function)
wcstombs Convert wide-character string to multibyte string (function)
© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us