ILE C/C++ Run-Time Library Functions


mbsinit() -- Test State Object for Initial State

Format

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

Language Level: ANSI

Threadsafe: Yes

Description

If ps is not a null pointer, the mbsinit() function specifies whether the pointed to mbstate_t object describes an initial conversion state.

Note:
This function is not available when you specify LOCALETYPE(*CLD) on the compilation command.

Return Value

The mbsinit() function returns nonzero if ps is a null pointer or if the pointed to object describes an initial conversion state. Otherwise, it returns zero.

Example that uses mbsinit()

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


#include <stdio.h>
#include <wchar.h>
#include <stdlib.h>
 
main()
{
   char     *string = "ABC";
   mbstate_t state = 0;
   wchar_t   wc;
   int   rc;
 
   rc = mbrtowc(&wc, string, MB_CUR_MAX, &state);
   if (mbsinit(&state))
     printf("In initial conversion state\n");
}

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]