The code below is giving me problems on Windows Mingw32 but not on WSL Ubuntu. The delimiter is (char)32 (space).
while (!feof(f)){
if(!fgets(line, LINE_LEN, f) || !*line || !strcmp(line, "\n")) continue;
word = strtok(line, &delim);
printf("xd\n");
while(word){
//printf("%s\n",word);s
add_item(h,word);
word = strtok(NULL, &delim);
wc++;
}
lc++;
}
I had tried debugging the code with CLion and the variable 'line' is correctly filled with given sentence that contain spaces, therefore strtok should not be returning null on the first iteration, yet it is. CLion Debug