int main(void)
{
FILE *fp = NULL;
int cnt = 0;
char line[1024] = "";
if((fp=fopen("c:\\WIN-TC\\projects\\puttext.txt","r"))==NULL)
{
printf("Cannot open file puttext any key exit!");
// getch();
exit(1);
}
printf("Can open file puttext!\n");
while(fgets(line, 1024, fp) != NULL)
{
++cnt;
printf("Line %d: %s", cnt, line);
}
fclose(fp);
putchar('\n');
return 0;
}[/CODE]
你参考一下,修改一下就能得到你想要的功能
----------------解决方案--------------------------------------------------------
谢谢你啊 ,我知道拉。。呵呵。。
----------------解决方案--------------------------------------------------------
----------------解决方案--------------------------------------------------------