- 论坛徽章:
- 0
|
谢谢提醒,我考虑代码比较长一点,就没有贴上来
经过调试,确定是作者的代码有误
yywrap()
{
FILE *file; 此处没有初始化为null,导致后面一直返回0,死循环了
if ((currentFile != 0) && (nFiles > 1) && (currentFile < nFiles)) {
/*
* we print out the statistics for the previous file.
*/
printf("%8lu %8lu %8lu %s\n", lineCount, wordCount,
charCount, fileList[currentFile-1]);
totalCC += charCount;
totalWC += wordCount;
totalLC += lineCount;
charCount = wordCount = lineCount = 0;
fclose(yyin); /* done with that file */
}
while (fileList[currentFile] != (char *)0) {
file = fopen(fileList[currentFile++], "r");
if (file != NULL) {
yyin = file;
break;
}
fprintf(stderr,
"could not open %s\n",
fileList[currentFile-1]);
}
return (file ? 0 : 1); /* 0 means there's more input */ |
|