%PAGEREF%(MinGW)

NAME
btowc - convert a single byte to a wide character

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

wint_t btowc( int 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 btowc() 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 btowc() to be directed to the libmingwex implementation; if neither macro is defined, calls to btowc() 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 btowc(); all calls will be directed to the libmingwex implementation.

DESCRIPTION
If c is not EOF, the btowc() function attempts to interpret c as a multibyte character sequence of length one; if the single byte evaluated represents a complete multibyte character, in the codeset which is associated with the LC_CTYPE category of the active process locale, btowc() converts it to, and returns, its equivalent wide character value.

RETURN VALUE
If c is EOF, or if it does not represent a complete multibyte character sequence of length one, btowc() returns WEOF; otherwise the conversion of the single byte character, to its equivalent wide character value, 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 btowc() 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 btowc() function is discouraged; it serves no purpose which may not be better served by the mbrtowc(3) function, which should be considered as a preferred alternative.

SEE ALSO
mbrtowc(3)

AUTHOR
This manpage was written by Keith Marshall, <keith@users.osdn.me>, to document the btowc() 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.