Since \n
is to act like a delimiter and not part of a word, add \n
to delimiter list.
const char *delims = "\",.-<>/;_?!(){}[]:= \n"; // added \n
char *p, *newStr;
while((p = fgets(buffer, sizeof(buffer), file)) != NULL){
newStr = strtok(p, delims);
while(newStr != NULL){
insertBranch(newStr);
newStr = strtok(NULL, delims);
}
}