Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How can I use the mbtowc()

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 01-02-2010
Member
 
Join Date: Jan 2010
Posts: 22
How can I use the mbtowc()
  

Hi, I am working in the PQR company. I am working there as a C programmer. I have the good knowledge of the C language. But I do not know about the mbtowc() function. So, I would like to know about the mbtowc() function. I would also like to know about the how can I use the mbtowc() function in the C program and what is the actual use of the mbtowc() function. Thus, Can anyone has the solution to my query? Post me a better solutions as early as you can.

Reply With Quote
  #2  
Old 01-02-2010
Member
 
Join Date: Nov 2005
Posts: 1,323
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.
Reply With Quote
  #3  
Old 01-02-2010
Member
 
Join Date: Oct 2005
Posts: 2,388
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.
Reply With Quote
  #4  
Old 01-02-2010
Member
 
Join Date: May 2008
Posts: 2,379
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
Reply With Quote
  #5  
Old 01-02-2010
Member
 
Join Date: Feb 2008
Posts: 1,844
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" );
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 02:46 AM.