mbstowcs - converts a sequence of multibyte characters into a sequence of characters of type wchar_t.
size_t mbstowcs (pwcs, s, n)
const char *s;
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.
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.
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 Alsomblen(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
Standard C Library (libc, -lc)
mbstowcs(wchar_t *restrict pwcs, const char *restrict s, size_t n);
mbstowcs_l(wchar_t *restrict pwcs, const char *restrict s, size_t n, locale_t loc);
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
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.
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
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
varchar2 is limiting me to take only... (0 Replies)
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)
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)
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)