Поделиться через


_mbsdec, _strdec, _wcsdec

unsignedchar*_mbsdec(constunsignedchar*start,constunsignedchar*current);

Routine Required Header Optional Headers Compatibility
_mbsdec <mbstring.h> <mbctype.h> Win 95, Win NT
_strdec <tchar.h> Win 95, Win NT
_wcsdec <tchar.h> Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

_mbsdec, _strdec and _wcsdec each return a pointer to the character that immediately precedes current; _mbsdec returns NULL if the value of start is greater than or equal to that of current. _tcsdec maps to one of these functions and its return value depends on the mapping.

Parameters

start

Pointer to first byte of any multibyte character in the source string; start must precede current in the source string

current

Pointer to first byte of any multibyte character in the source string; current must follow start in the source string

Remarks

The _mbsdec function returns a pointer to the first byte of the multibyte-character that immediately precedes current in the string that contains start. _mbsdec recognizes multibyte-character sequences according to the multibyte code page currently in use.

The generic-text function _tcsdec, defined in TCHAR.H, maps to _mbsdec if the _MBCS preprocessor definition has been specified, or to _wcsdec if _UNICODE has been defined. _tcsdec when used with the appropriate preprocessor definition, lets you generate code that will work regardless of the width of character strings. Otherwise _tcsdec maps to _strdec. _strdec and _wcsdec are single-byte character and wide-character versions of _mbsdec. _strdec and _wcsdec are provided only for this mapping and should not be used otherwise. For more information, see Using Generic-Text Mappings and Appendix B, Generic-Text Mappings.

String Manipulation Routines

Example

The following code snippet shows a use of _tcsdec.

   const TCHAR *str = _T("some text");
   const TCHAR *str2;
   TCHAR *answer;
   str2 = str;
   str2++;
   answer = _tcsdec( str, str2 );

The following code snippet shows a use of _mbsdec.

   char *str = "some text";
   char *str2;
   unsigned char *answer;
   str2 = str;
   str2++;
   answer = _mbsdec( reinterpret_cast<unsigned char *>( str ), reinterpret_cast<unsigned char *>( str2 ));

See Also   _mbsinc, _mbsnextc, _mbsninc