Index of Section 3 Manual Pages
| Interix / SUA | wcsntombs.3 | Interix / SUA |
wcsntombs(3) wcsntombs(3)
wcstombs()
NAME
wcstombs(), wcsntombs() - convert wide-character string value to a
character string
SYNOPSIS
#include
size_t wcstombs (char *s, const wchar_t *pwcs, size_t n)
size_t wcsntombs (char *s, const wchar_t *pwcs, size_t n, size_t m)
DESCRIPTION
The wcstombs(3) function converts the sequence of wide-character codes in
the array pointed to by pwcs to a sequence of characters that begins in
the initial shift state and stores these characters in the array pointed
to by s, stopping if a character would exceed the limit of n total bytes
or if a null byte is stored. Each wide-character code is converted as if
by a call to wctomb(3), except that the shift state of wctomb(3) is not
affected.
The behavior of this function is affected by the LC_CTYPE category of the
current locale.
No more than n bytes will be modified in the array pointed to by s. If
copying takes place between objects that overlap, the behavior is
undefined. If s is a null pointer, wcstombs(3) returns the length required
to convert the entire array regardless of the value of n, but no values
are stored.
The wcsntombs(3) function is identical to wcstombs(3), except that only
the number of characters specified by the m argument are converted.
RETURN VALUES
If a wide-character code is encountered that does not correspond to a
valid character (of one or more bytes each), both functions return
(size_t)-1 and may set errno to indicate the error. Otherwise both
functions return the number of bytes stored in the character array, not
including any terminating null byte. The array will not be null-terminated
if the value returned is n.
ERRORS
Either function may fail if:
[EILSEQ]
A wide-character code does not correspond to a valid character.
SEE ALSO
mblen(3)
mbtowc(3)
mbstowcs(3)
wctomb(3)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.