btowc(3)

btowc3

Convert single byte to wide character

Usage

#include <wchar.h>

wint_t btowc(int c);

Library

Standard C library (libc, -lc)

Overview

The btowc() function converts c, interpreted as a multibyte sequence of length 1, starting in the initial shift state, to a wide character and returns it. If c is EOF or not a valid multibyte sequence of length 1, the btowc() function returns WEOF.

Return value

The 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.

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
btowc()Thread safetyMT-Safe

Notes

The behavior of btowc() depends on the LC_CTYPE category of the current locale.

This function should never be used. It does not work for encodings which have state, and unnecessarily treats single bytes differently from multibyte sequences. Use either mbtowc(3) or the thread-safe mbrtowc(3) instead.

Releases

14 releases since Debian 2.2 (Potato); the text changed 13 times.

  1. 2.2
  2. 3.0
  3. 3.1
  4. 4.0
  5. 5.0
  6. 6.0
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. Arch

Standards

C11, POSIX.1-2008.

History

C99, POSIX.1-2001.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.