VMS Help  —  CRTL  wcschr  Example
        #include <stdlib.h>
        #include <stdio.h>
        #include <wchar.h>
        #include <string.h>

        #define BUFF_SIZE 50

        main()
        {
            int i;
            wchar_t s1buf[BUFF_SIZE];
            wchar_t *status;

            /* Initialize the buffer */

            if (mbstowcs(s1buf, "abcdefghijkl lkjihgfedcba", BUFF_SIZE)

                perror("mbstowcs");
                exit(EXIT_FAILURE);
            }

         /* This program checks the wcschr function by incrementally */
         /* going through a string that ascends to the middle and    */
         /* then descends towards the end.                           */

            for (i = 0; (s1buf[i] != '\0') && (s1buf[i] != ' '); i++) {
                status = wcschr(s1buf, s1buf[i]);
                /* Check for pointer to leftmost character -test 1. */
                if (status != &s1buf[i]) {
                    printf("Error in wcschr\n");
                    exit(EXIT_FAILURE);
                }
            }

            printf("Program completed successfully\n");
        }

      When this example program is run, it produces the following
      result:

        Program completed successfully
Close Help