请给出这几句代码吧
第1个回答 2013-02-13
FILE * fp;
unsigned short buf[5];
int i;
if ((fp = fopen("xxxx","r")) == NULL)
exit(1);
while (!feof(fp))
{
fread(buf, sizeof(unsigned short) * 5, fp);
printf(%d,%d,%d,%d,%d\n", buf[0], buf[1], buf[2], buf[3], buf[4]);
}
fclose(fp);本回答被提问者和网友采纳
unsigned short buf[5];
int i;
if ((fp = fopen("xxxx","r")) == NULL)
exit(1);
while (!feof(fp))
{
fread(buf, sizeof(unsigned short) * 5, fp);
printf(%d,%d,%d,%d,%d\n", buf[0], buf[1], buf[2], buf[3], buf[4]);
}
fclose(fp);本回答被提问者和网友采纳
第2个回答 2013-02-13
先要打开文件,使用fopen,fread读取文件内容,判断文件尾的方法我忘掉了,躯体你查查,读到内存buffer中,再显示出来,释放内存空间,关闭文件。基本上就这些步骤。
第3个回答 2013-02-13
while(c != EOF){..........}