memset(data,0,sizeof(data));//数据区
}
};
/*-----------------全局变量
--------------------------*/
FILE *fp; //磁盘文件地址
char * BaseAddr; //虚拟磁盘空间基地址string currentPath="C://"; //当前路径
int current=2; //当前目录的盘块号string cmd; //输入指令
struct DISK *osPoint; //磁盘操作系统指针
char command[16]; //文件名标识
struct OPENLIST* openlist; //用户文件列表指针
/*-----------函数事先申明--------------------*/ int mkdir(char *sonfname);
int create(char *name);
int listshow();
int delfile(char *name);
//int changePath(char *sonfname);
int write(char *name);
int exit();
int open(char *file);
int close(char *file);
int read(char *file);
/*------------初始化-----------------------*/
int format() {
current = 2;
currentPath="C://"; //当前路径
osPoint->format();//打开文件列表初始化
delete openlist;
openlist=new OPENLIST;
/*-------保存到磁盘上myfiles--------*/ fp = fopen(FilePath,"w+");
fwrite(BaseAddr,sizeof(char),DiskSize,fp);
fclose(fp);
printf("----------------------------------------------------------\n\n");
return 1;
}
/*-----------------------创建子目录
-------------------*/
int mkdir(char *sonfname)
{
//判断是否有重名
//寻找空白子目录项
//寻找空白盘块号
//当前目录下增加该子目录项
//分配子目录盘块,并且初始化
//修改fat表
int i,temp,iFAT;
struct dirFile *dir; //当前目录的指