| Main index | Section 3 | Options |
#include <wchar.h>
#include <uchar.h>
If s is NULL, these functions behave as if pc was NULL, s was an empty string ("") and n was 1.
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.
As a single char16_t is not large enough to represent certain multibyte characters, the mbrtoc16() function may need to be invoked multiple times to convert a single multibyte character sequence.
| 0 | The next n or fewer bytes represent the null wide character (L'\0'). |
| >0 | The next n or fewer bytes represent a valid character, these functions return the number of bytes used to complete the multibyte character. |
| (size_t )-1 | |
| An encoding error has occurred. The next n or fewer bytes do not contribute to a valid multibyte character. | |
| (size_t )-2 | |
| The next n contribute to, but do not complete, a valid multibyte character sequence, and all n bytes have been processed. | |
The mbrtoc16() function also returns:
| (size_t )-3 | |
| The next character resulting from a previous call has been stored. No bytes from the input have been consumed. | |
| [EILSEQ] | |
| An invalid multibyte sequence was detected. | |
| [EINVAL] | |
| The conversion state is invalid. | |
| MBRTOWC (3) | May 21, 2013 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Never write it in C if you can do it in `awk'; Never do it in `awk' if `sed' can handle it; Never use `sed' when `tr' can do the job; Never invoke `tr' when `cat' is sufficient; Avoid using `cat' whenever possible. |
” |
| — Taylor's Laws of Programming | ||