I wrote below code to readin line by line from stdin ex.
city=Boston;city=New York;city=Chicago
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]= ;
char* record = strtok(input, &del);
while(record) {
printf("Record: %s
",record);
record = strtok(NULL, &del);
}
}