Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mblen(3int) [ultrix man page]

mblen(3int)															       mblen(3int)

Name
       mblen - determines the number of bytes comprising a multibyte character

Syntax
       #include <stdlib.h>

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

Arguments
       s       The s argument is a pointer to the multibyte character string.

       n       The n argument is the maximum number of bytes in s that are examined.

Description
       If  s  is not a null pointer, the function determines the number of bytes comprising the multibyte character pointed to by s.  The function
       is equivalent to:
       (mbtowc((wchar_t *)0, s, n);)

       This function is affected by the LC_CTYPE category of the current locale.

Return Values
       If s is a null pointer, the function returns a zero value.  If s is not a null pointer, the function returns:

	  o  0 (if s points to the null character)

	  o  The number of bytes that comprise the multibyte character (if the next n or fewer bytes form a valid multibyte character)

	  o
	      -1 (if they do not form a valid multibyte character)

See Also
       mbtowc(3int), mbstowcs(3int), setlocale(3int), wctomb(3int), wcstombs(3int)

																       mblen(3int)

Check Out this Related Man Page

mbtowc(3int)															      mbtowc(3int)

Name
       mbtowc - converts a single multibyte character into a character of type wchar_t

Syntax
       #include <stdlib.h>

       int mbtowc (pwc, s, n)
       wchar_t *pwc;
       const char *s;
       size_t n;

Arguments
       pwc     The pwc argument is a pointer to the resulting object of type wchar_t.

       s       The s argument is a pointer to a multibyte character.

       n       The n argument is the maximum number of bytes of object s that are examined.

Description
       If  s  is  not  a null pointer, the function determines the number of bytes that comprise the multibyte character pointed to by s.  It then
       determines the character code for the value (of type wchar_t) that corresponds to that multibyte character (the value of  the  code  corre-
       sponding to the null character is zero). If the multibyte character is valid and pwc is not a null pointer, the function stores the code in
       the object pointed to by pwc.  At most n bytes of the array pointed to by s are examined.  This function is affected by the LC_CTYPE  cate-
       gory of the current locale.

Return Values
       If s is a null pointer, the function returns a zero value.  If s is not a null pointer, the function returns:

	  o  0, if s points to the null character

	  o  The number of bytes that comprise the converted multibye character, if the next n or fewer bytes form a valid multibye character

	  o  - -1, if the next n or fewer bytes do not form a valid multibye character

       In no case is the value returned greater than n or the value of the MB_CUR_MAX macro.

See Also
       mblen(3int), mbstowcs(3int), setlocale(3int), wctomb(3int), wcstombs(3int)

																      mbtowc(3int)
Man Page

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I count # of char. in a word?

I havent done shell scripting in quite some time. I want to know how to count the number of characters in a word, specifically a parameter. Example: myscript hello I want "myscript" to return the number of charcaters in the parameter "hello". Any ideas? (9 Replies)
Discussion started by: xadamz23
9 Replies

2. Programming

strlen for UTF-8

My OS (Debian) and gcc use the UTF-8 locale. This code says that the char size is 1 byte but the size of 'a' is really 4 bytes. int main(void) { setlocale(LC_ALL, "en_US.UTF-8"); printf("Char size: %i\nSize of char 'a': %i\nSize of Euro sign '': %i\nLength of Euro sign: %i\n",... (8 Replies)
Discussion started by: cyler
8 Replies

3. Shell Programming and Scripting

I want to find the difference between two files, only for the header (column names)

Hi All, I want to find the difference between two files, by checking only the headers (column names) and report if any new column is added in the latest file. For Ex: If the file "declartion.txt has these columns url;image;id;showcase_id;showcase_name and the actual file "feed.txt" has... (34 Replies)
Discussion started by: Praveen Pandit
34 Replies