#include  <string.h>
#include  <locale.h>
#include  <stdlib.h>

/*
 * The following example uses the wcswidth subroutine to find
 * the display column width of a wide character string.
 */
int main(int argc, char **argv) {
    wchar_t  *pwcs;
    int      retval;
    size_t   n;
 
    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 or nonprintable
         *  character  ode encountered in the wide  
         *  character string pwcs.
         */
    }
}