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).
Typical ways to make an mbstate_t object an initial state object are (for an mbstate_t object called mbs):
memset (&mbs,0,sizeof(mbs)); // mbs is zero-valued object
mbrlen (NULL,0,&mbs); // mbs set to an initial state
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.
- Check if initial conversion state (function