_strdec, _mbsdec, _wcsdec

From RAD Studio
Jump to: navigation, search

Go Up to string.h Index


Header File

mbstring.h, tchar.h

Category

Memory and String Manipulation Routines

Prototype

unsigned char *_mbsdec(const unsigned char *s, const unsigned char *p);
#define _strdec(__a, __b)    ((__b)-1)
#define _wcsdec(__a, __b)    ((__b)-1)

Description

_mbsdec returns a pointer p indicating the character in string s that is 1 byte backward. If there are no more characters before string p (it is the same position as s), _mbsdec returns a null pointer.

_strdec is the single-byte version of this function. _wcsdec is the wide-character version of this function.

Return Value

Returns a pointer to the character that is 1 byte backward, or a null pointer if there is no character before p.

Example

#include <mbstring.h>
#include <iostream>
using namespace std;

int main()
{
   unsigned char str[] = "012345";
  cout << "str: " << str << endl;

   unsigned char *result;
   result = _mbsdec( &str[0],&str[3]);

   cout << "result: " << result << endl;
	//output: "The string from the 3-rd character is: 2345"
   return (0);
}