WCRTOMB(3)
๐ธ WCRTOMB(3) ๐ธ
๐ NAME ๐
okay so this is the Library Functions Manual page for wcrtomb, c16rtomb, c32rtomb โ convert a wide-character code to a character (restartable). literally the whole vibe ๐
๐ LIBRARY ๐
Standard C Library (libc, -lc) โ that's the library, bestie ๐ซถ
โจ SYNOPSIS โจ
#include <wchar.h>
size_t
wcrtomb(char * restrict s, wchar_t c, mbstate_t * restrict ps);
#include <uchar.h>
size_t
c16rtomb(char * restrict s, char16_t c, mbstate_t * restrict ps);
size_t
c32rtomb(char * restrict s, char32_t c, mbstate_t * restrict ps);
๐ฆ DESCRIPTION ๐ฆ
okay so the tea โ: wcrtomb(), c16rtomb() and c32rtomb() store a multibyte sequence representing the wide character c, including any necessary shift sequences, to the character array s, storing a maximum of MB_CUR_MAX bytes. literally the glow-up from wide char to multibyte โจ
If s is NULL, these functions behave as if s pointed to an internal buffer and c was a null wide character (L'\0'). no cap, that's the rule.
The mbstate_t argument, ps, is used to keep track of the shift state. If it is NULL, these functions use an internal, static mbstate_t object, which is initialized to the initial conversion state at program startup. bestie, that static object is lowkey just always there.
As certain multibyte characters may only be represented by a series of 16-bit characters, the c16rtomb() may need to be invoked multiple times before a multibyte sequence is returned. so yeah, sometimes it's a multi-step situation ๐
๐ฅ RETURN VALUES ๐ฅ
These functions return the length (in bytes) of the multibyte sequence needed to represent c, or (size_t)-1 if c is not a valid wide character code. that's the whole return story, fr fr ๐ซถ
๐ ERRORS ๐
The wcrtomb(), c16rtomb() and c32rtomb() functions will fail if:
[EILSEQ]โ an invalid wide character code was specified.[EINVAL]โ the conversion state is invalid.
๐ SEE ALSO ๐
๐ STANDARDS ๐
The wcrtomb(), c16rtomb() and c32rtomb() functions conform to ISO/IEC 9899:2011 (โISO C11โ). periodt. ๐
mwah ๐ this page is from Debian, dated May 21, 2013, and it's the WCRTOMB(3) page โ bye bestie, go convert some wide chars responsibly! ๐ซถ๐
๐ฆ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2002-2004 Tim J. Robbins
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms