|
| ||||||||||
| Tags: c language, function, library, mbtowc |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How can I use the mbtowc()
|
|
#2
| ||||
| ||||
| mbtowc()
Hello, A character of single multibyte pointed to by pointer parameter into the character code that can be corresponds to it, can be converted by the mbtowc() function. For all of null character can be zero. The code can be stored in the object that is pointed to by pwc, If pwc can not be a NULL pointer and the multibyte character can not be valid. The mbtowc() function could not examined more than M_CR_MX bytes. |
|
#3
| ||||
| ||||
| How can I use the mbtowc()
The mbtowc() function can returns the following, If t can not be a NULL pointer : 1. If the next fewer or n bytes form a valid character of multibyte, then returns the number of bytes that can comprise the character of mutibyte. 2. If the next n bytes can not form a valid character of multibyte returns -1 . 3. If t can points to the null character, returns the zero. The mbtowc() function can return the zero if encoding of character of mutibyte can not be state dependent and otherwise returns the nonzero, If t can be a NULL pointer.
__________________ Grand Theft Auto 4 PC Video Game |
|
#4
| ||||
| ||||
| Program : mbtowc()
#include<stdio.h> #include<stdlib.h> int lnt, tmp; char strdt [6] = "n"; wchr_t m_ary[6]; int main(void) { lnt = mblen(NULL, M_CR_MAX); lnt = mblen(strdt, M_CR_MAX); tmp = mbtowc(arr,strdt,lnt); m_ary[1] = L'\0'; printf("wide character strdata: %ls\n", m_ary); }
__________________ The FIFA Manager 2009 PC Game |
|
#5
| ||||
| ||||
| Re: How can I use the mbtowc()
#include <stdio.h> #include <stdlib.h> void main() { char *w = "string"; wchr_t wbfr[10]; int j, ln; printf( "Character encodings do %shave " "state-dependent \nencoding.\n",( mbtowc( wbuffer, NULL, 0 ) )? "" : "not " ); ln = mbtowc( wbfr, wc, 2 ); wbfr[ln] = '\0'; printf( "%s(%d)\n", wc, ln ); for( j = 0; j < ln; j++ ) printf( "/%4.4x", wbfr[j] ); printf( "\n" ); } |