mbsinit(), mbsinit_l()

determines if object describes an initial conversion state 

Function


SYNOPSIS

#include <wchar.h>

int mbsinit(const mbstate_t *ps);

#include <wchar.h>

#include <locale.h>

int mbsinit_l(const mbstate_t *ps, locale_t locale);


DESCRIPTION

If the specified pointer is not null, the mbsinit() and mbsinit_l() functions determine whether it describes an initial conversion state.

An mbstate_t object is used to describe the current conversion state from a particular character sequence to a wide character sequence (or vice-versa) under the rules of a particular setting of the LC_CTYPE locale category.

The initial conversion state corresponds, for a conversion in either direction, to the beginning of a new character sequence in the initial shift state. A zero valued mbstate_t object is at least one way to describe an initial conversion state. A zero valued mbstate_t object can be used to initiate conversion involving any character sequence, in any LC_CTYPE setting.

mbsinit_l() behaves in the same way as mbsinit() without the _l suffix, but uses the specified locale rather than the global or per-thread locale. A locale_t is returned by newlocale().

If an mbstate_t object is altered by any of the functions described as restartable, and is then used with a different character sequence, or in the other conversion directory, or with a different LC_CTYPE category setting than on earlier function calls, the behavior is undefined.


PARAMETERS

ps 

Points to the state variable to test.

locale 

Is a locale_t perhaps returned by newlocale() or LC_GLOBAL_LOCALE or 0 for the current thread locale set with uselocale().


RETURN VALUES

The mbsinit() and mbsinit_l() functions return non-zero if ps is a null pointer, or if the pointed-to object describes an initial conversion state; otherwise, it returns zero.


CONFORMANCE

mbsinit() conforms to ANSI/ISO 9899:1999 'ISO C99'

mbsinit_l() conforms to IEEE Std 1003.1-2008 'POSIX.1'


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

The mbsinit() function is MT-Safe as long as no thread calls setlocale() while this function is executing.

The function mbsinit_l() is MT-Safe as long as no thread calls freelocale() on locale while this function is executing.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
mbrlen(), mbrlen_l(), mbrtowc(), mbrtowc_l(), mbsnrtowcs(), mbsnrtowcs_l(), mbsrtowcs(), mbsrtowcs_l(), newlocale(), setlocale(), wcrtomb(), wcrtomb_l(), wcsrtombs(), wcsrtombs_l()


PTC MKS Toolkit 10.4 Documentation Build 39.