You were redirected to cplusplus.com/mbsinit || See search results for: "mbsinit"
function
<cwchar>

mbsinit

int mbsinit (const mbstate_t* ps);
Check if initial conversion state
Checks whether ps points to a mbstate_t object that describes an initial conversion 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). This function returns non-zero for any mbstate_t object representing an initial state, or if ps is a null pointer.

Calling this function never changes the state identified by ps.

The state pointed by ps can be set to the initial state by calling:
 
memset (ps,0,sizeof(*ps));  // ps points now to a zero-valued object 


Parameters

ps
Pointer to an mbstate_t object.

Return Value

A non-zero value if ps points to a mbstate_t object that describes an initial conversion state, or if ps is a null pointer.
Otherwise, a zero value is returned.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* mbsinit example */
#include <wchar.h>
#include <string.h>
#include <stdio.h>

int main()
{
  char buffer[80];
  mbstate_t mbst;
  const wchar_t wcs [] = L"mbsinit example";
  const wchar_t * p;

  p = wcs;

  if ( !mbsinit(&mbst) )
    memset (&mbst,0,sizeof(mbst));  /* set to initial state */

  wcsrtombs ( buffer, &p, 80, &mbst);
  printf (buffer);

  return 0;
}


Output:
mbsinit example

See also