else {
for(iLoop = 0; iLoop < N; iLoop++) {
fgets(str2[iLoop], LEN - 1, fp); } }
fclose(fp);
for(iLoop = 0; iLoop < N; iLoop++) {
printf(\ } return 0; } 16.8 #include #define N 10
int main() {
float num; int iLoop; FILE *fp;
fp = fopen(\ if(fp == NULL) {
printf(\创建文件失败!\\n\ return 1; }
/* 从键盘读入10个数并写文件 */ printf(\请输入%d个数:\ for(iLoop = 0; iLoop < N; iLoop++) {
scanf(\
fwrite(&num, sizeof(num), 1, fp); }
/* 文件指针回到开始处 */ rewind(fp);
/* 从文件读出10个数并显示 */ for(iLoop = 0; iLoop < N; iLoop++) {
fread(&num, sizeof(num), 1, fp); printf(\ }
/* 移文件指针到第四个数开始处 */ fseek(fp, 3L*sizeof(num), SEEK_SET); /* 读入一个新数据 */ printf(\请输入一个新数据:\ scanf(\
fwrite(&num, sizeof(num), 1, fp); /* 文件指针回到开始处 */ rewind(fp);
/* 从文件读出10个数并显示 */ for(iLoop = 0; iLoop < N; iLoop++) {
fread(&num, sizeof(num), 1, fp); printf(\ }
/* 关闭文件 */ fclose(fp); return 0; }