Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mbstowcs(3int) [ultrix man page]

mbstowcs(3int)															    mbstowcs(3int)

Name
       mbstowcs - converts a sequence of multibyte characters into a sequence of characters of type wchar_t.

Syntax
       #include <stdlib.h>)

       size_t mbstowcs (pwcs, s, n)
       wchar_t *pwcs;
       const char *s;
       size_t n;

Arguments
       pwcs    The pwcs argument is a pointer to the resulting wide character string.

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

       n       The n argument is the maximum number of resulting wide characters stored in pwcs.

Description
       The  function converts a sequence of multibyte characters from the array pointed to by s into a sequence of characters of type wchar_t, and
       stores not more than n characters into the array pointed to by pwcs. No multibyte characters that follow a null character  (which  is  con-
       verted  into a code with value zero) are examined or converted. No more than n elements are modified in the array pointed to by pwcs.  This
       function is affected by the LC_CTYPE category of the current locale.

Return Values
       If an invalid multibyte character is encountered, the function returns (size_t) -1.  Otherwise, the function returns the  number  of  array
       elements modified, not including a terminating null character, if any. The array will not be null-terminated if the value returned is n.

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

																    mbstowcs(3int)

Check Out this Related Man Page

MBSTOWCS(3)						   BSD Library Functions Manual 					       MBSTOWCS(3)

NAME
mbstowcs, mbstowcs_l -- convert a character string to a wide-character string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> size_t mbstowcs(wchar_t *restrict pwcs, const char *restrict s, size_t n); #include <stdlib.h> #include <xlocale.h> size_t mbstowcs_l(wchar_t *restrict pwcs, const char *restrict s, size_t n, locale_t loc); DESCRIPTION
The mbstowcs() function converts a multibyte character string s, beginning in the initial conversion state, into a wide character string pwcs. No more than n wide characters are stored. A terminating null wide character is appended, if there is room. Although the mbstowcs() function uses the current locale, the mbstowcs_l() function may be passed a locale directly. See xlocale(3) for more information. RETURN VALUES
The mbstowcs() function returns the number of wide characters converted, not counting any terminating null wide character, or -1 if an invalid multibyte character was encountered. ERRORS
The mbstowcs() function will fail if: [EILSEQ] An invalid multibyte sequence was detected. [EINVAL] The conversion state is invalid. SEE ALSO
mbsrtowcs(3), mbtowc(3), multibyte(3), xlocale(3) STANDARDS
The mbstowcs() function conforms to ISO/IEC 9899:1999 (``ISO C99''). BSD
April 8, 2004 BSD
Man Page

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to declare an array to take more than 10,000 characters

Hi Guys Need some help I am reading the string values from the text files into the shell script and had them feed into array I have declared an associative array as TYPE t_user_id_tab IS TABLE OF VARCHAR2(3000);\n my_user_id t_user_id_tab;\n varchar2 is limiting me to take only... (0 Replies)
Discussion started by: pinky
0 Replies

2. Shell Programming and Scripting

Unix character set problem

Hi All, We are getting file into our unix box with multibyte characters. When we tried to view the file the record looks like this Frédéric Actually the data sent to us is Frédéric --> my locale charmap of unix is set to UTF8 only ... but still i am getting this problem. I... (6 Replies)
Discussion started by: sandeeppvk
6 Replies

3. Programming

How will the behaviour of multibyte char differ because of different LC_CTYPE locale?

I am comparing two multibyte characters in two different platforms having different LC_CTYPE variables, they are returning different values. One of the variable is sigma initialised to "\317\203" and the other one is empty string i.e, "" Below is the scenario of the two platforms: In... (4 Replies)
Discussion started by: baig_1988
4 Replies

4. Shell Programming and Scripting

Patterns with egrep/sed/awk?

I have an array with characters, what I want is if there are other characters in the array which I am looking for than take action that is print BAD ARRAY. So far my code just finds characters but instead I want that it should look for other characters. echo "A B C D F" | egrep -o "D | F" O/P... (5 Replies)
Discussion started by: dixits
5 Replies

5. Linux

Issue in inserting null string in array

I am getting some values from a file and putting them in an array..but the null strings are not getting passed to the array. So during printing the elements ,the null string is not showing in the output. during array size calculation it is also excluding null.Please let me know how to do it. # cat... (2 Replies)
Discussion started by: millan
2 Replies