_mbsdec, _mbsdec_l, _strdec, _wcsdec
Moves a string pointer back one character.
unsigned char *_mbsdec( const unsigned char *start, const unsigned char *current ); unsigned char *_mbsdec_l( const unsigned char *start, const unsigned char *current, _locale_t locale );
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.
- locale
-
Locale to use.
The _mbsdec and _mbsdec_l function returns a pointer to the first byte of the multibyte character that immediately precedes current in the string that contains start.
The output value is affected by the setting of the LC_CTYPE category setting of the locale; see setlocale for more information. _mbsdec recognizes multibyte-character sequences according to the local currently in use, while _mbsdec_l is identical except that it use the locale parameter passed in instead.
If start or current is NULL, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, this function returns EINVAL and sets errno to EINVAL.
Security Note This API incurs a potential threat brought about by a buffer overrun problem. Buffer overrun problems are a frequent method of system attack, resulting in an unwarranted elevation of privilege. For more information, see Avoiding Buffer Overruns.
| Tchar.h routine | _UNICODE and _MBCS not defined | _MBCS defined | _UNICODE defined |
|---|---|---|---|
| _tcsdec | _strdec | _mbsdec | _wcsdec |
_strdec and _wcsdec are single-byte character and wide-character versions of _mbsdec and _mbsdec_l. _strdec and _wcsdec are provided only for this mapping and should not be used otherwise.
For more information, see Using Generic-Text Mappings and Generic-Text Mappings.
| Routine | Required header | Optional header | Compatibility |
|---|---|---|---|
| _mbsdec | <mbstring.h> | <mbctype.h> | Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
| _mbsdec_l | <mbstring.h> | <mbctype.h> | Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
| _strdec | <tchar.h> |
| Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
| _wcsdec | <tchar.h> |
| Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
For more compatibility information, see Compatibility in the Introduction.
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 ));
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.