Compartilhar via


_mbbtype, _mbbtype_l

Returns the byte type based on the previous byte.

int _mbbtype(
   unsigned char c,
   int type 
);
int _mbbtype_l(
   unsigned char c,
   int type,
   _locale_t locale
);

Parameters

  • c
    Character to test.

  • type
    Type of byte to test for.

  • locale
    Locale to use.

Return Value

_mbbtype returns the type of byte within a string. This decision is context-sensitive as specified by the value of type, which provides the control test condition. type is the type of the previous byte in the string. The manifest constants in the following table are defined in Mbctype.h.

Value of type

_mbbtype tests for

Return value

c

Any value except 1

Valid single byte or lead byte

_MBC_SINGLE (0)

Single byte (0x20 – 0x7E, 0xA1 – 0xDF)

Any value except 1

Valid single byte or lead byte

_MBC_LEAD (1)

Lead byte of multibyte character (0x81 – 0x9F, 0xE0 – 0xFC)

Any value except 1

Valid single-byte or lead byte

_MBC_ILLEGAL 

( –1)

Invalid character (any value except 0x20 – 0x7E, 0xA1 – 0xDF, 0x81 – 0x9F, 0xE0 – 0xFC

1

Valid trail byte

_MBC_TRAIL (2)

Trailing byte of multibyte character (0x40 – 0x7E, 0x80 – 0xFC)

1

Valid trail byte

_MBC_ILLEGAL 

( –1)

Invalid character (any value except 0x20 – 0x7E, 0xA1 – 0xDF, 0x81 – 0x9F, 0xE0 – 0xFC

Remarks

The _mbbtype function determines the type of a byte in a multibyte character. If the value of type is any value except 1, _mbbtype tests for a valid single-byte or lead byte of a multibyte character. If the value of type is 1, _mbbtype tests for a valid trail byte of a multibyte character.

The output value is affected by the setting of the LC_CTYPE category setting of the locale; see setlocale for more information. The _mbbtype version of this function uses the current locale for this locale-dependent behavior; the _mbbtype_lversion is identical except that it use the locale parameter passed in instead. For more information, see Locale.

In earlier versions, _mbbtype was called chkctype. For new code, use _mbbtype instead.

Requirements

Routine

Required header

Optional header

_mbbtype

<mbstring.h>

<mbctype.h>*

_mbbtype_l

<mbstring.h>

<mbctype.h>*

* For definitions of manifest constants used as return values.

For more compatibility information, see Compatibility in the Introduction.

.NET Framework Equivalent

Not applicable, but see System::Globalization::CultureInfo.

See Also

Reference

Byte Classification