Multibyte conversion state
Type that holds the information necessary to maintain the state when converting between sequences of multibyte characters and wide characters (either way).

Multibyte sequence encodings may have different shift states that change how the next byte character is interpreted. Values of type mbstate_t are able to keep these states between function calls so that the translation of a sequence can be performed safely across more than one call.

All valid multibyte sequences shall begin (and end) in the same state (called its initial state). A zero-valued mbstate_t object always describes an initial conversion state, although other values may also represent such state (depending on the particular library implementation).

An mbstate_t object (mbs) can be set to the initial state by calling:
memset (&mbs,0,sizeof(mbs));  // mbs is now a zero-valued object 

Two mbstate_t values shall not be compared to each other to check for a particular state; The initial state status of a mbstate_t object can be checked with function mbsinit.

See also