[求助]怎么解决这个文件问题。。。。
有一个文本,一行存一些数据(但此行不满),存若干行,要想读取第二行数怎么办?怎么知道第一行读完?怎么把指针指到第二行呢?
如:
| 123456789 123456789 。。。。。 。。。。。 |

| 123456789 123456789 。。。。。 。。。。。 |
2007-07-20 15:55
2007-07-20 16:13
2007-07-20 16:18
2007-07-20 16:55
2007-07-20 16:58
2007-07-20 16:59
这样对吗?怎么运行了结果不对呢?
#include "stdio.h"
main()
{
FILE *fp;
int i,j=0;
char str,c;
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!");
while(fgetc(fp)!=EOF)
{
str=fgetc(fp);
if(str=="\n");
{
printf("\n");
fgets(c,14,fp);
puts(c);
}
}
fclose(fp);
getch();
}

2007-07-20 17:03
2007-07-20 17:03
2007-07-20 17:06
定义成数组我已经试了,也不是我想要的,我想不是那个的问题,另外你所说的读完一行,测长度,问题是我就是不知道怎么才算读完一行!难道就是读完"\n".吗?

2007-07-21 08:49