Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

wcwidth(3) OSS Library Calls Reference Manual
NAME
wcwidth - Determines the display width of wide characters
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <wchar.h>
int wcwidth(
wchar_t wc);
PARAMETERS
wc Specifies a wide character.
DESCRIPTION
The wcwidth( ) function determines the number of display columns to be occupied by the wide
character specified by the wc parameter. The behavior of the wcwidth( ) function is determined
by the LC_CTYPE category.
EXAMPLES
The following example finds the display width of a wide character.
#include <string.h>
#include <locale.h>
main()
{
wchar_t wc;
int retval;
(void)setlocale(LC_ALL, "");
/* Let wc be the wide character whose
** display width is to be found.
*/
retval= wcwidth( wc );
if(retval == -1){
/*
** Error handling. Invalid wide character in wc.
*/
}
}
RETURN VALUES
The wcwidth( ) function returns the number of display columns to be occupied by the wc param-
eter. If the wc parameter is a null wide character, a value of 0 (zero) is returned. If the wc param-
eter points to an invalid wide character code, a value of -1 is returned.
RELATED INFORMATION
Functions: wcwidth(3).
862 Hewlett-Packard Company 527187-017