DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

wcwidth(S)


wcwidth, wcswidth -- determine number of column positions of a wide-character code or string

Syntax

cc . . . -lc

#include <wchar.h>

int wcwidth(wint_t wc); int wcswidth(const wchar_t *pwcs, size_t n);

Description

wcwidth(S) determines the number of column positions that the wide character wc occupies, and returns the number. Its argument, wc, must have a value that may be represented as a wchar_t, and corresponds to a valid character in the current locale.

wcswidth(S) determines the number of column positions that the first n wide-character codes in the array pwcs will occupy. If pwcs points to a string of less than n wide characters, the number of column positions that the string will occupy is determined instead.

Return values

These routines return the number of column positions to be occupied. If wc is a null wide-character code or pwcs points to a null string, zero is returned. wcswidth( ) may also return -1 in two situations: when any of the first n wide-character codes in the array pwcs is not a printing wide-character code, or, if pwcs points to a string of length n or less, when any of the wide-character codes in this string is not a printing wide-character code.

Diagnostics

The value of errno is undefined.

See also

The definition of ``Column Position'' in X/Open CAE Specification, System Interface Definitions, Issue 4, 1992, Chapter 2, Glossary

Standards conformance

wcwidth( ) and wcswidth( ) are conformant with:
X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003