操作系统 文件存储空间管理(14)
时间:2026-01-14
时间:2026-01-14
操作系统 文件存储空间管理 c++代码
strcpy(cmd[5].com,"vi");
strcpy(cmd[6].com,"del");
strcpy(cmd[7].com,"deldir");
strcpy(cmd[8].com,"cd");
strcpy(cmd[9].com,"cd..");
strcpy(cmd[10].com,"help");
strcpy(cmd[11].com,"quit");
strcpy(cmd[12].com,"chengzu");
if((fp=fopen("system","rb"))==NULL) //判断系统文件是否存在
{
printf("can not open file\n");
printf("format the disk Y / N \n");
scanf("%c",&k);
if(k=='y')
format();
}
else
{
read_file(fp); //读取系统文件的内容
}
while(1)
{
j=0; //必须重新给恢复0否则出错
strcpy(tmp,cur_dir);
while(strcmp(tmp,"root")!=0)
{
for(i=0;i<640;i++)
{
p=root[i].i_num;
if(strcmp(tmp,root[i].file_name)==0 && (i_node[p].file_style==0))
{
strcpy(tmp2[j].com,tmp);
j++;
strcpy(tmp,root[i].dir_name);
}
}
}
strcpy(tmp2[j].com,tmp);
for(i=j;i>=0;i--)
{
printf("%s/",tmp2[i].com);
}
上一篇:四川移动公司协同办公视频会议系统
下一篇:单人简易呼吸囊操作流程