#include #include #include //contians atoi for string to int conversion /* * This program is a simple? way of parsing a csv character array * * * */ int main() { int x,y,z; char input[16] = "545,394,2"; char *p; p = strtok(input, ","); if(p){ x=atoi(p); } p = strtok(NULL, ","); if(p){ y=atoi(p); } p = strtok(NULL, ","); if(p){ z=atoi(p); } printf("X: %d\n", x); printf("Y: %d\n", y); printf("Z: %d\n", z); return 0; }