The following function stores a Unicode character as a Unicode string in memory.
int u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n) ¶int u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n) ¶int u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n) ¶Puts the multibyte character represented by uc in s, returning its length. Returns -1 upon failure, -2 if the number of available units, n, is too small. The latter case cannot occur if n >= 6/2/1, respectively.
This function is similar to wctomb, except that it operates on a
Unicode strings, s must not be NULL, and the argument n must be
specified.