简单文件系统的实现实验报告(4)

2018-12-04 21:20

openlist->f[OpenFileCount] = dir->fcb[FcbIndex]; //FCB拷贝 openlist->files ++; printf(\文件打开成功!\\n\ OpenFileCount++; return 1; }

int close(char *file) { //释放该文件所占内存//释放用户打开文件列表表项 int i; //在打开文件列表中查找 file(还需要考虑同名不同目录文件的情况!!!) for(i=0;if [i].type = GENERAL)&& (strcmp(openlist->f [i].fname,file)==0)){ if(openlist->f[i].fatherBlockNum == current) { break; } else{ printf(\该文件已打开,但未在当前目录下,无法关闭!\\n\ return 0; } } } if(i==OPEN_MAX){ printf(\该文件未在打开列表中!\\n\ return 0; } int active=i; openlist->files --; openlist->f[active].initialize(); OpenFileCount--; printf(\该文件已关闭!\\n\ return 1; }

int main() { printf(\ @n\ printf(\ 以下是使用说明书:\\n\使用说明书 printf(\@@@@@@@@@@@@@@@\\n\ printf(\对磁盘格式化. @ \\n\

printf(\ :安全退出该文件系统,保存信息. @ \\n\ printf(\创建子目录. @ \\n\ printf(\删除子目录. @ \\n\ printf(\ dirname :显示当前目录下信息. @ \\n\ printf(\ dirname :更改当前目录. @ \\n\ printf(\创建一个新文件,并且打开. @ \\n\ printf(\选择一个打开的文件写入信息 @ \\n\ printf(\ filename :选择一个打开的文件读取信息. @ \\n\ printf(\ filename :删除文件. @ \\n\ printf(\ filename :打开文件. @\\n\ printf(\关闭文件. @\\n\ printf(\@@@@@@@@@@@@@@@\\n\\n\ openlist=new OPENLIST;//创建用户文件打开表 BaseAddr=(char *)malloc(DiskSize);//申请虚拟空间并且初始化 osPoint=(struct DISK *)(BaseAddr);//虚拟磁盘初始化 if((fp=fopen(FilePath,\加载磁盘文件 fread(BaseAddr,sizeof(char),DiskSize,fp); printf(\加载磁盘文件( %s )成功,现在可以进行操作了!\\n\\n\ } else{ printf(\这是你第一次使用该文件管理系统!\\t正在初始化...\\n\ format(); printf(\初始化已经完成,现在可以进行操作了!\\n\\n\ } while(1){ cout<>cmd; if(cmd==\ format(); } else if(cmd==\ cin>>command; mkdir(command); } else if(cmd==\ cin>>command; rmdir(command); } else if(cmd==\ listshow(); } else if(cmd==\ cin>>command;

}

changePath(command); }

else if(cmd==\ cin>>command; create(command); }

else if(cmd==\ cin>>command; write(command); } else if(cmd==\ cin>>command; read(command); } else if(cmd==\ cin>>command; delfile(command); } else if(cmd==\ cin>>command; open(command); } else if(cmd==\ cin>>command; close(command); } else if(cmd==\ exit(); break; } else cout<<\无效指令,请重新输入:\}

printf(\return 1;


简单文件系统的实现实验报告(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:新型墙体材料专项基金征收使用管理办法层(财综[2007]77号)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: