![]() Chapter Contents |
![]() Previous |
![]() Next |
| wcstombs |
| Portability: | ISO/ANSI C conforming |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTIONS | |
| EXAMPLE |
| SYNOPSIS |
#include <stdlib.h> size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
| DESCRIPTION |
wcstombs
converts a sequence of wide characters (pure DBCS sequence)
to a sequence of multibyte characters (mixed DBCS sequence). The wide characters
are in the array pointed to by
pwcs
, and the resulting multibyte characters are stored in the array
pointed to by
s
. The resulting
multibyte character sequence begins in the initial shift state.
n
specifies the maximum number of bytes to be filled with multibyte characters.
The conversion stops if a multibyte character would exceed the limit of
n
bytes or if a null character
is stored.
| RETURN VALUE |
If the multibyte character sequence is
valid,
wcstombs
returns
the number of bytes of
s
that were modified, excluding the terminating
0
byte, if any. If the sequence of multibyte characters is invalid,
wcstombs
returns
-1
.
| CAUTIONS |
If copying takes place between objects
that overlap, the behavior of
wcstombs
is undefined.
A diagnostic is not issued if
wcstombs
encounters invalid data; a return value
of
-1
is the only indication
of an error.
| EXAMPLE |
See the example for
mbstowcs
.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.