回复 20 楼 sidooh
谢谢您 有心了!以下是引用wp231957在2014-10-11 09:55:21的发言:
你试试这段代码
#include<stdio.h>
int main()
{
FILE *fp;
int i;
char a[5]={0};
fp=fopen("d:\\12300.txt","r+");
if(fp==NULL)
{
printf("can't found the file\n");
return 0;
}
for(i=0;i<5;i++)
{
fread(a+i,1,1,fp);
printf(" a[%d]=%c \n",i,a);
}
fclose(fp);
return 0;
}
你试试这段代码
#include<stdio.h>
int main()
{
FILE *fp;
int i;
char a[5]={0};
fp=fopen("d:\\12300.txt","r+");
if(fp==NULL)
{
printf("can't found the file\n");
return 0;
}
for(i=0;i<5;i++)
{
fread(a+i,1,1,fp);
printf(" a[%d]=%c \n",i,a);
}
fclose(fp);
return 0;
}
可以一试