Next: , Previous: , Up: Elementary string functions   [Contents][Index]


4.3.2 Creating Unicode strings one character at a time

The following function stores a Unicode character as a Unicode string in memory.

Function: int u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n)
Function: int u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n)
Function: 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.