Library /sys$common/syshlp/helplib.hlb  —  CRTL  strstr  Example
        #include <stdlib.h>
        #include <stdio.h>
        #include <string.h>

        main()
        {
            static char lookin[]="that this is a test was at the end";

            putchar('\n');
            printf("String: %s\n", &lookin[0] );
            putchar('\n');
            printf("Addr: %s\n", &lookin[0] );
            printf("this: %s\n", strstr( &lookin[0] ,"this") );
            printf("that: %s\n", strstr( &lookin[0] , "that" ) );
            printf("NULL: %s\n", strstr( &lookin[0], "" ) );
            printf("was: %s\n", strstr( &lookin[0], "was" ) );
            printf("at: %s\n", strstr( &lookin[0], "at" ) );
            printf("the end: %s\n", strstr( &lookin[0], "the end") );
            putchar('\n');

            exit(0);
        }

    This example produces the following results:

    $ RUN STRSTR_EXAMPLE
    String: that this is a test was at the end
    Addr: that this is a test was at the end
    this: this is a test was at the end
    that: that this is a test was at the end
    NULL: that this is a test was at the end
    was: was at the end
    at: at this is a test was at the end
    the end: the end
    $
Close Help