C++ Standard Library C++ STL Library

C++ <cstdlib> - MB_CUR_MAX constant



The C++ <cstdlib> MB_CUR_MAX is a macro constant that expands to a positive integer expression of type size_t, the value of which is the maximum number of bytes in a multibyte character with the current locale (category LC_CTYPE). Its value is never greater than MB_LEN_MAX.

In the <cstdlib> header file, it is defined as follows:

#define MB_CUR_MAX /* implementation defined */             

Example:

The example below shows the value of MB_CUR_MAX constant in an environment's default locale.

#include <iostream>
#include <clocale>
#include <cstdlib>

using namespace std;
 
int main (){
  //setting LC_CTYPE to Environment's 
  //default locale
  setlocale(LC_CTYPE, "");    

  //displaying the value of MB_CUR_MAX
  cout<<"MB_CUR_MAX = "<<MB_CUR_MAX;
 
  return 0;
}

One of the possible output of the above code could be:

MB_CUR_MAX = 1

❮ C++ <cstdlib> Library