下列程序用来建立一个随机文件f1.dat,将键盘输入的一个浮点数f写入第5条记录。请填空。
#include
main()
{floatf;
FILE*fp;
printf("\ninputafloatnumber:");
scanf("%f,&f;)
if((____)==NULL)
{printf("Can'topenfile\n");exit(0);}
fseek(fp,4*sizeof(float),SEEK_SET)
if(____!=1)
printf("filewriteerror.\n");
fclose(fo);
}
填空内容为打开文件和向文件中写入数据。 fp=fopen("f1.dat","wb") fwrite(&f,4*sizeof(float),l,fp)