HELPLIB.HLB  —  CRTL  wcschr
    Scans for a wide character in a specified wide-character string.

    Format

      #include  <wchar.h>

      wchar_t *wcschr  (const wchar_t *wstr, wchar_t wc);

1  –  Function Variants

    The wcschr function has variants named _wcschr32 and _wcschr64
    for use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 wstr

    A pointer to a null-terminated wide-character string.

 wc

    A character of type wchar_t.

3  –  Description

    The wcschr function returns the address of the first occurrence
    of a specified wide character in a null-terminated wide-character
    string. The terminating null character is considered to be part
    of the string.

    See also wcsrchr.

4  –  Return Values

    x                  The address of the first occurrence of the
                       specified wide character.
    NULL               Indicates that the wide character does not
                       occur in the string.

5  –  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