/** * Using strtok to parse a tab separated file * @author gtowell * @created: March 2021 * **/ #include #include #include #ifndef NULL #define NULL (void *) 0 #endif //12:54 AM 73 F 65 F 76 % S 8 mph 0 mph 30.00 in 0.0 in int main(void) { char aa[512]; while (NULL != fgets(aa, 1000, stdin)) { fprintf(stderr, "%s\n", aa); char *tk = strtok(aa, "\t"); fprintf(stderr, "%s\n", tk); while(1) { tk = strtok(NULL, "\t"); if (tk==NULL) break; fprintf(stderr, "%s\n", tk); } } }