/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that tokenizes the string, "The summer soldirer, 
the sunshine patriot" with spaces and commas being the delimiters. 
The output is The|summer|soldier|the sunshine|patriot. */
#include <stdio.h>
#include <string.h>

int main() {
    char *token, *str1, *delimit;
    char *endptr = NULL;
   
    str1 = "The summer soldier, the sunshine patriot";
    delimit = " ,"; 
    for(token = strtok_r(str1, delimit, &endptr); token!= NULL;
        token = strtok_r(NULL, delimit, &endptr)) {
        printf("token = %s\n", token);
    }
}

