SYNOPSIS
#include <wchar.h>
int wcwidth(wchar_t wc);
int wcwidth_l(wchar_t wc, locale_t locale);
DESCRIPTION
The
PARAMETERS
- wc
-
The wide character to scan.
- locale
-
Is a locale_t perhaps returned by
newlocale() or LC_GLOBAL_LOCALE or 0 for the current thread locale set withuselocale() .
RETURN VALUES
The
EXAMPLES
This code fragment reads text from standard input and breaks lines that are more than 20 column positions wide, similar to the fold utility:
wint_t ch; int column, w; column = 0; while ((ch = getwchar()) != WEOF) { w = wcwidth(ch); if (w > 0 && column + w >= 20) { putwchar(L'\n'); column = 0; } putwchar(ch); if (ch == L'\n') { column = 0; } else if (w > 0) { column += w; } }
CONFORMANCE
MULTITHREAD SAFETY LEVEL
MT-Safe, with exceptions.
The function
The function
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
iswprint() ,newlocale() ,setlocale() ,wcswidth() ,wcswidth_l()
PTC MKS Toolkit 10.4 Documentation Build 39.