Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wcswidth(3C) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought



wcswidth(3C)                   DG/UX R4.11MU05                  wcswidth(3C)


NAME
       wcswidth - determine the number of column positions for a wide
       character string

SYNOPSIS
       #include <wchar.h>
       int wcswidth(const wchart *pwcs, sizet n);

DESCRIPTION
       wcswidth determines the number of column printing positions needed
       for up to n wide characters in the wide string pwcs.  Fewer than n
       wide characters will be processed only if a null wide character is
       encountered before n wide characters in pwcs.

   Return Values
       wcswidth returns either zero if pwcs is pointing to a null wide
       character code, or the number of column positions occupied by the
       wide character string pointed to by pwcs.  wcswidth returns -1 if any
       wide character code in the wide character string pointed to by pwcs
       is not a printable wide character.

EXAMPLES
       This example function, when passed a wide character string,
       calculates the number of column positions required and prints a
       diagnostic message.

              #include <wchar.h>
              #include <stdio.h>
              . . .
              int
              printwidth(const wchart *pwcs)
              {
                   int width;
                   sizet len;
                   len = wcslen(pwcs);
                   if (len > 0)  {
                        width = wcswidth (pwcs, len);
                        if (width == -1)
                           (void) printf("non printable character\n");
                        else
                           (void) printf("Wide string width=%d\n",width);
                        return (1);
                   }
                   (void) printf("zero length wide character string\n");
                   return (0);

              }

REFERENCES
       wcwidth(3C)


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026