wcswidth(), wcswidth_l()

number of column positions in wide-character string 

Function


SYNOPSIS

#include <wchar.h>

int wcswidth(const wchar_t pwcs, size_t n);

int wcswidth_l(cnost wchar_t pwcs, size_t n, locale_t locale);


DESCRIPTION

The wcswidth() and wcswidth_l() functions determine the number of column positions required for the first n characters of pwcs, or until a null wide character (L'\0') is encountered.

wcswidth_l() behaves in the same way as wcswidth() without the _l suffix, but uses the specified locale rather than the global or per-thread locale. A locale_t is returned by newlocale().


PARAMETERS

pwcs 

The wide string to scan.

n 

The number of characters in pwcs to examine.

locale 

Is a locale_t perhaps returned by newlocale() or LC_GLOBAL_LOCALE or 0 for the current thread locale set with uselocale().


RETURN VALUES

The wcswidth() and wcswidth_l() functions return 0 if pwcs is an empty string (L""), -1 if a non-printing wide character is encountered, otherwise they returns the number of column positions occupied.


CONFORMANCE

wcswidth() conforms to IEEE Std 1003.1-2001 'POSIX.1'. wcswidth_l() conforms to IEEE Std 1003.1-2008 'POSIX.1'.


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

The function wcwidth() is MT-Safe as long as no thread calls setlocale() while this function is executing.

The function wcwidth_l() is MT-Safe as long as no thread calls freelocale() on locale while this function is executing.


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(), wcwidth(), wcwidth_l()


PTC MKS Toolkit 10.4 Documentation Build 39.