mbsinit -- Test Object for Initial State

Format

#include <wchar.h>
int mbsinit(mbstate_t *state);

Language Level: Extension
mbsinit determines whether the state describes an initial conversion state.

Note: mbsinit is provided only for compatibility with EBCDIC systems that support conversion or shift states.

The code pages do not use shift states for multibyte character encoding.

Return Value
If state is a null pointer or points to 0, mbsinit returns a nonzero value. If state points to any other value, mbsinit returns 0. On systems that support shift states, mbsinit returns nonzero if state describes an initial conversion state, or 0 otherwise.

Example
This example checks the conversion state to see if it is in the initial state.

#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
   char      *string = "ABC";
   mbstate_t state = 0;
   wchar_t   wc;
   mbrtowc(&wc, string, MB_CUR_MAX, &state);
   if (0 != mbsinit(&state))
      printf("In initial conversion state.\n");
   return 0;
   /********************************************
      The output should be similar to:
      In initial conversion state.
   ********************************************/
}



mbrlen -- Calculate Length of Multibyte Character
mbrtowc -- Convert Multibyte Character to Wide Character
mbsrtowcs -- Convert Multibyte String to Wide-Character String
setlocale -- Set Locale
wcrtomb -- Convert Wide Character to Multibyte Character
wcsrtombs -- Convert Wide-Character String to Multibyte String
<locale.h>
<wchar.h>