cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : C Library : cstdlib (stdlib.h) : wcstombs
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
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

-

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

Convert wide-character string to multibyte string

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

Parameters

mbstr
Pointer to an array of char elements at least max bytes long.
wcstr
C wchar_t string to be trasnlated.
max
Maximum number of bytes to be written to mbstr.

Return Value

The number of bytes (not characters) translated and written to mbstr, 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)
wctomb Convert wide character to multibyte character (function)
mbstowcs Convert multibyte string to wide-character string (function)

Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us