Stuff
public text v1 · immutable#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
char buf[256];
char ptr[256];
char *x, *y, *z, *v;
strcpy(buf, "test string 1");
strcpy(ptr, "some,comma,delimited,values");
for (x = strtok_r(buf, " ", &z); x; x = strtok_r(NULL, " ", &z)) {
printf("x is [%s]\n", x);
for (y = strtok_r(ptr, ",", &v); y; y = strtok_r(NULL, ",", &v)) {
printf("y is [%s]\n", y);
}
}
}