- while(!feof())
- {
- fread或fscanf
- ...
- ...
- }
- while(1)
- {
- fwrite或fscanf();
- if(feof())
- break;
- ...
- ...
- }
{
FILE *fp=fopen("a","wb");
float a=1.6868;
fwrite(&a, sizeof(float), 1, fp);
fclose(fp);
fp=fopen("a","rb");
while(!feof(fp))
{
fread(&a, sizeof(float), 1, fp);
printf("%f ",a);
}
fclose(fp);
return 0;
}