是tNode->position数组越界了,具体的话就是第128个"the"这个单词的position数组越界了,你将这个数组的长度定义成BUFSIZ,在默认情况下就是512,当读到第128个"the"时,数组长度超过512,所以报错
改正的方法有两个:
1.把BUFSIZ定义的大一些,在main.c的第173行加上
if (strlen(tNode->position) + strlen(temp) + 1 >= 512) {
printf("Error here, and the word [%s], tNode->position size[%d]\n", tNode->data, strlen(tNode->position));
getchar();
exit(0);
}
出错处理,凑合着能用,不至于崩溃。
2.不用固定值,用realloc函数,每次数组即将越界的时候追加申请新的内存。
看了一下,这种逻辑复杂,不是花24小时搞完的
下载不了……