|  #include <wchar.h> | 
| wint_t
               
               
               btowc (int c); | 
| int
               
               
               wctob (wint_t c); | 
         
         
          btowc
         function returns the wide character converted from the single byte
         
         
          c
         
         
         
.If 
         
         
          c
         is EOF or not a valid multibyte sequence of length 1, it returns WEOF.
         
         
         
      
The wctob function converts a wide character into a corresponding single-byte character. If the wide character is WEOF or not able to be represented as a single byte in the initial shift state, wctob returns WEOF.
The behavior of the btowc and wctob is affected by LC_CTYPE category of the current locale.
#include <wchar.h>
/* Illustrates how to use btowc API */
wint_t example_btowc(int c)
{
 wint_t wc;
 /* converting single byte to wide-character */
 wc = btowc(c);
 /* return the character that was converted */
return (wc);
}
         
      
#include <wchar.h>
/* Illustrates how to use wctob API */
int example_wctob(void)
{
 wint_t wc = L’a’;
 int c;
  
 /* represent a wide-char in a single byte*/
 c = wctob(wc);
 /* return the single byte */
 return(c);
}
         
      The btowc and wctob functions conform to -p1003.1-2001.
The btowc and wctob functions first appeared in 5.0.
Feedback
For additional information or queries on this page send feedback
| © 2005-2007 Nokia |