Mac Developer Library Developer


This manual page is part of Xcode Tools version 5.0

To obtain these tools:

If you are running a version of Xcode Tools other than 5.0, view the documentation locally:

  • In Xcode

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • To learn how the manual is organized or to learn about command syntax, read the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Developer Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.

BTOWC(3)                 BSD Library Functions Manual                 BTOWC(3)

     btowc, btowc_l, wctob, wctob_l -- convert between wide and single-byte characters

     Standard C Library (libc, -lc)

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

     btowc(int c);

     wctob(wint_t c);

     #include <wchar.h>
     #include <xlocale.h>

     btowc_l(int c, locale_t loc);

     wctob_l(wint_t c, locale_t loc);

     The btowc() function converts a single-byte character into a corresponding wide character.  If the
     character is EOF or not valid in the initial shift state, btowc() 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.

     While the btowc() and wctob() functions use the current locale, the btowc_l() and wctob_l() functions
     may be passed locales directly. See xlocale(3) for more information.

     The include file <stdio.h> is not necessary for these functions.

     mbrtowc(3), multibyte(3), wcrtomb(3), xlocale(3), compat(5)

     The btowc() and wctob() functions conform to IEEE Std 1003.1-2001 (``POSIX.1'').

     The btowc() and wctob() functions first appeared in FreeBSD 5.0.

BSD                             August 3, 2002                             BSD

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.