Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

wcswidth(3) [osf1 man page]

wcswidth(3)						     Library Functions Manual						       wcswidth(3)

NAME
wcswidth - Determines the display width of wide-character strings LIBRARY
Standard C Library (libc) SYNOPSIS
#include <wchar.h> int wcswidth( const wchar_t *pwcs, size_t n); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: wcswidth(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Contains a pointer to the wide-character string. Specifies the maximum number of wide characters whose display width is to be determined. DESCRIPTION
The wcswidth() function determines the number of display columns to be occupied by the number of wide characters specified by the n parame- ter in the string pointed to by the pwcs parameter. The behavior of the wcswidth() function is affected by the LC_CTYPE category. Fewer than the number of wide characters specified by the n parameter are counted if a null wide character is encountered first. EXAMPLES
The following example finds the display column width of a wide-character string: #include <wchar.h> #include <locale.h> main() { wchar_t *pwcs; int retval, n ; (void)setlocale(LC_ALL, ""); /* Let pwcs point to a wide-character null-terminated ** string. Let n be the number of wide characters whose ** display column width is to be determined. */ retval= wcswidth( pwcs, n ); if(retval == -1){ /* Error handling. Invalid wide-character code ** encountered in the wide-character string pwcs. */ } } RETURN VALUES
The wcswidth() function returns the number of display columns to be occupied by the specified number of wide characters or (if a null wide character is encountered first) by the number of wide characters encountered before the null. The function returns a value of 0 (zero) if the pwcs parameter is a null pointer or a pointer to a null pointer (that is, if either pwcs or *pwcs is null. The function returns -1 if the pwcs parameter points to a nonprinting wide character. RELATED INFORMATION
Functions: mblen(3), wcslen(3), wcwidth(3) Standards: standards(5) delim off wcswidth(3)

Check Out this Related Man Page

WCSWIDTH(3P)						     POSIX Programmer's Manual						      WCSWIDTH(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
wcswidth - number of column positions of a wide-character string SYNOPSIS
#include <wchar.h> int wcswidth(const wchar_t *pwcs, size_t n); DESCRIPTION
The wcswidth() function shall determine the number of column positions required for n wide-character codes (or fewer than n wide-character codes if a null wide-character code is encountered before n wide-character codes are exhausted) in the string pointed to by pwcs. RETURN VALUE
The wcswidth() function either shall return 0 (if pwcs points to a null wide-character code), or return the number of column positions to be occupied by the wide-character string pointed to by pwcs, or return -1 (if any of the first n wide-character codes in the wide-character string pointed to by pwcs is not a printable wide-character code). ERRORS
No errors are defined. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
This function was removed from the final ISO/IEC 9899:1990/Amendment 1:1995 (E), and the return value for a non-printable wide character is not specified. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
wcwidth(), the Base Definitions volume of IEEE Std 1003.1-2001, Section 3.103, Column Position, <wchar.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 WCSWIDTH(3P)
Man Page