%PAGEREF%(MinGW)

NAME
wctob - convert a wide character to a single byte

SYNOPSIS
#include <stdio.h>
#include <wchar.h>

int wctob( wint_t c );

    Feature Test Macro Requirements for libmingwex:

__MSVCRT_VERSION__: since mingwrt-5.3, if this feature test macro is defined, with a value of at least 0x0800, (corresponding to the symbolic constant, __MSCVR80_DLL, and thus declaring intent to link with MSVCR80.DLL, or any later version of Microsoft's non-free runtime library, instead of with MSVCRT.DLL), calls to wctob() will be directed to the implementation thereof, within Microsoft's runtime DLL.

_ISOC99_SOURCE, _ISOC11_SOURCE: since mingwrt-5.3.1, when linking with MSVCRT.DLL, or when __MSVCRT_VERSION__ is either undefined, or is defined with any value which is less than 0x0800, (thus denying intent to link with MSVCR80.DLL, or any later non-free version of Microsoft's runtime library), explicitly defining either of these feature test macros will cause any call to wctob() to be directed to the libmingwex implementation; if neither macro is defined, calls to wctob() will be directed to Microsoft's runtime implementation, if it is available, otherwise falling back to the libmingwex implementation.

Prior to mingwrt-5.3, none of the above feature test macros have any effect on wctob(); all calls will be directed to the libmingwex implementation.

DESCRIPTION
The wctob() function converts the wide character, represented by c, to a multibyte character sequence in the codeset which is associated with the LC_CTYPE category of the active process locale. Provided the entire conversion can be accommodated within a single byte, the value of that byte, interpreted as an unsigned char, and cast to an int, is returned; otherwise, EOF is returned.

RETURN VALUE
If the conversion of c, to a multibyte character sequence, in its entirety, occupies exactly one byte, the value of that byte, interpreted as an unsigned char, and cast to an int, is returned; otherwise, EOF is returned.

ERROR CONDITIONS
No error conditions are defined.

STANDARDS CONFORMANCE
Except to the extent that it may be affected by limitations of the underlying MS-Windows API, the libmingwex implementation of wctob() conforms generally to ISO-C99, POSIX.1-2001, and POSIX.1-2008; (prior to mingwrt-5.3, and in those cases where calls may be delegated to a Microsoft runtime DLL implementation, this level of conformity may not be achieved).

CAVEATS AND BUGS
Use of the wctob() function is discouraged; it serves no purpose which may not be better served by the wcrtomb(3) function, which should be considered as a preferred alternative.

SEE ALSO
wcrtomb(3)

AUTHOR
This manpage was written by Keith Marshall, <keith@users.osdn.me>, to document the wctob() function as it has been implemented for the MinGW.org Project. It may be copied, modified and redistributed, without restriction of copyright, provided this acknowledgement of contribution by the original author remains in place.