Name
wcsrtombs
Synopsis
Converts a wide character string into a multibyte string and saves the parse state
#include <wchar.h> size_twcsrtombs
( char * restrictdest
, const wchar_t ** restrictsrc
, size_tn
, mbstate_t * restrictstate
);
The wcsrtombs()
function
converts one or more wide characters from the array indirectly
addressed by src
into a string of
multibyte characters, beginning in the parse state indicated by the
state
argument, and stores the results in
the array of char
addressed by
dest
. (dest
may also be a null pointer, in which case wcsrtombs()
does not actually store any
output characters, and does not modify the pointer in the location
addressed by src
. The function therefore
merely returns the number of bytes that a multibyte representation
of the wide character string would occupy.) The third argument,
n
, specifies the maximum number of
characters that can be written to the output buffer. The conversion
performed on each wide character is the same as that which would be
performed by the wcrtomb()
function, updating the mbstate_t
object addressed by state
. Conversion
ends on the first of three possible events:
- When a terminating null character has been written to the output buffer.
In this case,
wcsrtombs()
stores a null pointer in the location addressed bysrc
, and returns the number of bytes in the multibyte sequence resulting from the conversion. The object addressed bystate
represents the initial parse state, and the terminating null character stored in the output ...
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.