mblen - determine number of bytes in next multibyte character


   #include <stdlib.h>

   int mblen(const char *s, size_t n);


   If  s is not NULL, the mblen() function inspects at most n bytes of the
   multibyte string starting at s and extracts the next complete multibyte
   character.   It  uses  a static anonymous shift state known only to the
   mblen() function.  If the multibyte character  is  not  the  null  wide
   character,  it  returns  the number of bytes that were consumed from s.
   If the multibyte character is the null wide character, it returns 0.

   If the n bytes starting at  s  do  not  contain  a  complete  multibyte
   character,  mblen()  returns  -1.  This can happen even if n is greater
   than or equal to MB_CUR_MAX, if the multibyte string contains redundant
   shift sequences.

   If  the  multibyte  string  starting at s contains an invalid multibyte
   sequence before the next complete character, mblen() also returns -1.

   If s is NULL, the mblen() function resets the  shift  state,  known  to
   only  this  function,  to the initial state, and returns nonzero if the
   encoding has nontrivial  shift  state,  or  zero  if  the  encoding  is


   The  mblen()  function  returns  the  number  of  bytes parsed from the
   multibyte sequence starting at s, if  a  non-null  wide  character  was
   recognized.  It returns 0, if a null wide character was recognized.  It
   returns -1, if an invalid multibyte sequence was encountered or  if  it
   couldn't parse a complete multibyte character.


   For   an   explanation   of   the  terms  used  in  this  section,  see

   Interface  Attribute      Value          
   mblen()    Thread safety  MT-Unsafe race 


   POSIX.1-2001, POSIX.1-2008, C99.


   The behavior of mblen() depends on the LC_CTYPE category of the current

   The  function  mbrlen(3)  provides  a  better  interface  to  the  same




   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at

More Linux Commands

lmap(n) Iterate over all elements in one or more lists and c
The lmap command implements a loop where the loop variable(s) take on values from one or more lists, and the loop returns a list of results collected from each

rpcclient(1) - tool for executing client side MS-RPC functio
This tool is part of the samba(7) suite. rpcclient is a utility initially developed to test MS-RPC functionality in Samba itself. It has undergone several stage

XtCancelSelectionRequest(3) - bundle multiple selection conv
When XtCreateSelectionRequest is called, subsequent calls to XtGetSelectionValue and XtGetSelectionValueIncremental with the requestor and selection as specifie

fminl(3) - determine minimum of two floating-point numbers
These functions return the lesser value of x and y. RETURN VALUE These functions return the minimum of x and y. If one argument is a NaN, the other argument is

y4munsharp(1) - Unsharp filter for YUV4MPEG2 streams........
y4munsharp is an implementation of the GIMP unsharp filter for YUV4MPEG2 streams. The usual 3 parameters for unshap mask processing (radius, amount and threshol

FcNameRegisterObjectTypes(3) - Register object types........
Register ntype new object types. Returns FcFalse if some of the names cannot be registered (due to allocation failure). Otherwise returns FcTrue. VERSION Fontco

attemptckrealloc(3) - allocate or free heap memory (ManPage)
These procedures provide a platform and compiler independent interface for memory allocation. Programs that need to transfer ownership of memory blocks between

set_menu_pad(3menu) - color and attribute control for menus
The function set_menu_fore sets the foreground attribute of menu. This is the highlight used for selected menu items. menu_fore returns the foreground attribute

XrmInitialize(3) - initialize the Resource Manager, Resource
The XrmInitialize function initialize the resource manager. It must be called before any other Xrm functions are used. The XrmParseCommand function parses an (a

gnutls_x509_crl_get_next_update(3) - API function (ManPage)
This function will return the time the next CRL will be issued. This field is optional in a CRL so it might be normal to get an error instead. RETURNS when the

This module defines get(), give() and fh() methods common to X11::Protocol::Connection types that are based on the FileHandle package. They expect the object th

Tk_CreateErrorHandler(3) - handle X protocol errors.........
Tk_CreateErrorHandler arranges for a particular procedure (proc) to be called whenever certain protocol errors occur on a particular display (display). Protocol

We can't live, work or learn in freedom unless the software we use is free.