
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <stdlib.h>
int wctomb( char *s, wchar_t wc );
#include <mbstring.h>
int _fwctomb( char __far *s, wchar_t wc );
Description:
The wctomb function determines the number of bytes required to represent
the multibyte character corresponding to the wide character contained in
wc. If s is not a NULL pointer, the multibyte character representation
is stored in the array pointed to by s. At most MB_CUR_MAX characters
will be stored.
The _fwctomb function is a data model independent form of the wctomb
function that accepts far pointer arguments. It is most useful in mixed
memory model applications.
Returns:
If s is a NULL pointer, the wctomb function returns zero if multibyte
character encodings are not state dependent, and non-zero otherwise. If
s is not a NULL pointer, the wctomb function returns:
Value Meaning
-1
if the value of wc does not correspond to a valid multibyte character
len
the number of bytes that comprise the multibyte character corresponding
to the value of wc.
Example:
#include <stdio.h>
#include <stdlib.h>
#include <mbctype.h>
wchar_t wchar = { 0x0073 };
char mbbuffer[2];
void main()
{
int len;
_setmbcp( 932 );
printf( "Character encodings are %sstate dependent\n",
( wctomb( NULL, 0 ) )
? "" : "not " );
len = wctomb( mbbuffer, wchar );
mbbuffer[len] = '\0';
printf( "%s(%d)\n", mbbuffer, len );
}
produces the following:
Character encodings are not state dependent
s(1)
Classification:
wctomb is ANSI, _fwctomb is not ANSI
Systems:
wctomb - All, Netware
_fwctomb - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
See Also:
mblen, mbstowcs, mbtowc, wcstombs
See Also:
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson