读书人

关于文件读写的有关问题。求。

发布时间: 2012-12-15 15:16:03 作者: rapoo

关于文件读写的问题。。。急求。。。
void main()
{
char ch;
if ((source = fopen("test1.txt","r")) == NULL)
{
printf("cannot open source file!\n");
exit(0);
}
if ((code = fopen("tokenOut.txt","w")) == NULL)
{
printf("cannot open destination file!\n");
exit(0);
}
while((ch=fgetc(source)) != EOF)
{
getToken();
}
fclose(source);
}
想读取test1.txt的内容,一个一个字符读取,用getToken()函数分析并输出分析结果,为什么没有结果输出?

读书人网 >C语言

热点推荐