}
int ShowBitMp() { }
int findBit() { return 0; }
int ShowFat()
return 0; }
for(i=0;i if(list[i]!=0) printf(\ %0x\printf(\if(i==0) } MAP=(struct map *)(file+(FATNUM+1)*BLOCK_SIZE); j=0; for(i=DATABEG+1;i if(MAP->maplist[i]==1) { list[j]=i; j++; struct map *MAP; int i,j; int list[BLOCK_SIZE]={0}; printf(\已经成功删除%s\\n\return 0; { } /** 退出系统 */ int exit() { fp=fopen(FilePath,\ fwrite(file,sizeof(char),DISK_SIZE,fp); fclose(fp); free(file); } return 0; } FAT=(struct fatid *)(file+BLOCK_SIZE); j=0; for(i=DATABEG+1;i for(i=0;i if(list[i]!=0) { printf(\ %0x\if(flag){ if(j==0) } flag=1; j++; printf(\if(FAT->id[i]!=0) { } list[j]=i; j++; int i,j,flag; struct fatid *FAT; int list[BLOCK_SIZE]={0}; } return 1; void welcome() { } int main() { int length; //加载 if((fp=fopen(FilePath,\{ { } printf(\这是第一次使用文件管理系统\fread(file,sizeof(char),DISK_SIZE,fp); printf(\加载磁盘文件%s文件成功,现在可以操作\\n\\n\printf(\//申请虚拟空间 file=(char *)malloc(DISK_SIZE*sizeof(char)); printf(\printf(\以下是使用说明\\n\ printf(\ : 对磁盘格式化.\\n\ printf(\ : 安全退出该文件系统,保存信息.\\n\printf(\ dirname ; 创建子目录.\\n\printf(\ dirname : 删除子目录.\\n\printf(\ dirname : 显示当前目录下信息.\\n\printf(\ dirname : 更改当前目录.\\n\ printf(\ length : 创建一个新文件.\\n\printf(\ filename : 删除文件.\\n\printf(\复制文件.\\n\printf(\ 显示位示图.\\n\printf(\T 显示FAT.\\n\ //欢迎列表 }else char newname[20]; welcome(); format(); while(1) { cout< if(strcmp(cmd,\ free(file); file=(char*)malloc(DISK_SIZE*sizeof(char)); format(); }else if(strcmp(cmd,\ { scanf(\ mkdir(command); }else if(strcmp(cmd,\ { scanf(\ rmdir(command); } else if(strcmp(cmd,\ { listshow(); }else if(strcmp(cmd,\ { scanf(\ changedir(command); }else if(strcmp(cmd,\ { cin>>command>>length; create(command,length); }else if(strcmp(cmd,\ { cin>>command>>newname; cp(command,newname); }else if(strcmp(cmd,\ { scanf(\ delfile(command); }else if(strcmp(cmd,\ //重新分配空间 } exit(); break; }else if(strcmp(cmd,\T\ ShowFat(); }else if(strcmp(cmd,\ ShowBitMp(); } else { printf(\无效指令,请重新输入:\\n\} } printf(\return 0; 实验截图: