wcswidth

Computes the number of column positions required by a wide-character string.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <wchar.h> 
   
  int  wcswidth (
     const wchar_t   *wcs,
     size_t           n);
  

Parameters

wcs

(IN) Points to the wide-character string.

n

(IN) Specifies the number of wide-character codes to scan.

Return Values

If successful, returns the number of column positions that the specified wide-character string requires. Otherwise, returns 0 if wcs points to a null-terminating wide-character code or -1 if any wide-character code in the first n codes of the string is not printable.

Remarks

If a null-terminating wide-character code is encountered before n wide-character codes, the function stops scanning and returns.

See Also

wcwidth