WCWIDTH(3C) Standard C Library Functions WCWIDTH(3C)
wcwidth, wcwidth_l - number of column positions of a wide-character
code
#include <wchar.h>
int wcwidth(wchar_t wc);
#include <wchar.h>
#include <xlocale.h>
int wcwidth_l(wchar_t wc, locale_t loc);
The wcwidth() function determines the number of column positions
required for the wide character wc. The value of wc must be a
character representable as a wchar_t, and must be a wide-character
code corresponding to a valid character in the current locale.
The function wcwidth_l() behaves identically to wcwidth(), except
instead of operating in the current locale, it operates in the locale
specified by loc.
These functions either return 0 (if wc is a null wide-character
code), or the number of column positions to be occupied by the wide-
character code wc, or -1 (if wc does not correspond to a printing
wide-character code).
No errors are defined.
See attributes(7) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|CSI | Enabled |
+--------------------+-----------------+
|Interface Stability | See below. |
+--------------------+-----------------+
|MT-Level | MT-Safe |
+--------------------+-----------------+
The wcwidth() function is Standard. The wcwidth_l() function is
Uncommitted.
newlocale(3C), setlocale(3C), uselocale(3C), wcswidth(3C),
attributes(7), standards(7)
June 25, 2014 WCWIDTH(3C)
NAME
wcwidth, wcwidth_l - number of column positions of a wide-character
code
SYNOPSIS
#include <wchar.h>
int wcwidth(wchar_t wc);
#include <wchar.h>
#include <xlocale.h>
int wcwidth_l(wchar_t wc, locale_t loc);
DESCRIPTION
The wcwidth() function determines the number of column positions
required for the wide character wc. The value of wc must be a
character representable as a wchar_t, and must be a wide-character
code corresponding to a valid character in the current locale.
The function wcwidth_l() behaves identically to wcwidth(), except
instead of operating in the current locale, it operates in the locale
specified by loc.
RETURN VALUES
These functions either return 0 (if wc is a null wide-character
code), or the number of column positions to be occupied by the wide-
character code wc, or -1 (if wc does not correspond to a printing
wide-character code).
ERRORS
No errors are defined.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|CSI | Enabled |
+--------------------+-----------------+
|Interface Stability | See below. |
+--------------------+-----------------+
|MT-Level | MT-Safe |
+--------------------+-----------------+
The wcwidth() function is Standard. The wcwidth_l() function is
Uncommitted.
SEE ALSO
newlocale(3C), setlocale(3C), uselocale(3C), wcswidth(3C),
attributes(7), standards(7)
June 25, 2014 WCWIDTH(3C)