wcwidth(3C) SDK R4.11 wcwidth(3C)
NAME
wcwidth - determine the number of column positions for a wide
character
SYNOPSIS
#include <wchar.h>
int wcwidth(wintt wc);
DESCRIPTION
wcwidth determines the number of column printing positions that are
needed by the wide character wc.
Return Values
wcwidth returns zero if wc is a null wide character, or the number of
column printing positions the wide character wc occupies. wcwidth
returns -1 if wc does not correspond to a valid, printable wide
character.
EXAMPLE
Here is a program that reads a wide character from standard input and
prints the width of the character.
#include <wchar.h>
#include <stdio.h>
main()
{
int x;
wintt wc;
if ((wc=fgetwc(stdin)) != WEOF) {
x=wcwidth(wc);
if (x==-1)
(void) printf("Character not printable\n");
else
(void) printf("Character width=%d\n",x);
exit(0);
}
(void) printf("Error encountered reading character\n");
exit(2);
}
REFERENCES
wcswidth(3C)
Licensed material--property of copyright holder(s)