A pointer to a constant `mbstate_t` object representing the current shift state for multibyte to wide character conversions. The pointed-to state cannot be modified through this pointer.
1st Parameter
Pointer to an `mbstate_t` object representing the current conversion state. If `ps` is `NULL`, the function considers the state as initialized.
Read more about parameters of mbsinit in parameters section
The mbsinitfunction in C language Checks if the multibyte state object is in the initial state.
The mbsinit function determines whether the pointed-to mbstate_t object describes an initial conversion state. It returns non-zero if ps is a null pointer or if the pointed-to object describes an initial conversion state; otherwise, it returns zero.
The mbsinitfunction takes 1
parameter:
•
const mbstate_t * `ps`: Pointer to an `mbstate_t` object representing the current conversion state. If `ps` is `NULL`, the function considers the state as initialized.
Checks if the given conversion state object `ps` is in its initial state, indicating that no partial multibyte character is being processed. Returns a nonzero value if the state is initial or `ps` is `NULL`, and `0` otherwise.
The mbsinit function return value :
Returns non-zero if ps is NULL or if *ps describes an initial conversion state; otherwise, returns zero
Output
This example demonstrates basic usage of mbsinit to check the state before and after a multibyte conversion.