Hi All,
I wrote below code to readin line by line from stdin ex.
city=Boston;city=New York;city=Chicago\n
and then split each line by ';' delimiter and print each record.
But for some reason the "record" pointer comes back always null. Why?
char del = ';';
char input[BUFLEN];
while(fgets(input, BUFLEN, fp)) {
input[strlen(input)-1]='\0';
char* record = strtok(input, &del);
while(record) {
printf("Record: %s\n",record);
record = strtok(NULL, &del);
}
}