WCSWIDTH(3)

NAME
wcswidth, wcswidth_l - number of column positions in wide-character string

SYNOPSIS
#include <wchar.h>
int
wcswidth(const wchar_t *pwcs, size_t n);
#include <xlocale.h>
int
wcswidth_l(const wchar_t *pwcs, size_t n, locale_t loc);

DESCRIPTION
The wcswidth() and .Fn 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.

The function wcswidth_l() uses the locale provided as parameter, whil wcswidth() uses the currente locale.

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 return the number of column positions occupied.

SEE ALSO
iswprint(3), strlen(3), wcslen(3), wcwidth(3) xlocale(3)

STANDARDS
The wcswidth() function conforms to p1003.1-2001.

HISTORY
The wcswidth() function was ported from NetBSD and first appeared in OpenBSD 3.8.