shuru:
printf(\scanf(\for(i=0;i {if(!strcmp(namestr,mfd[i].uname)) /*xiang deng*/ break; }/*for*/ if(i>=N) { printf(\ goto shuru; } instructions: printf(\printf(\———→create a file\\n\printf(\ ———→open a file\\n\printf(\ ———→close a file\\n\printf(\ ———→read a file\\n\printf(\ ———→write a file\\n\printf(\———→delete a file\\n\printf(\ ———→quit the system\\n\printf(\scanf(\ if(!strcmp(order,\ { create(i); goto instructions;} else if(!strcmp(order,\ { open(i); goto instructions; } else if(!strcmp(order,\ { close(i); goto instructions; } else if(!strcmp(order,\ { Read(i); goto instructions; } else if(!strcmp(order,\ { delete(i); goto instructions; } else if(!strcmp(order,\ { write(i); goto instructions; } else if(!strcmp(order,\ { printf(\ return(0); } else { printf(\ goto instructions; } } /*-------------zhu han shu------------------*/ /*=================create()==================== */ create(int x){ char filename[20]; int j; int length; char prority[20]; int address; rand();/*chu shi hua sui ji han shu*/ printf(\ printf(\ scanf(\ for(j=0;j { if(!strcmp(mfd[x].ufd[j].fname,filename))/*yi cun zai*/ { printf(\ break; }/*if*/ else if(strlen(mfd[x].ufd[j].fname)==0) /*bu cun zai*/ { strcpy(mfd[x].ufd[j].fname,filename); printf(\ printf(\ scanf(\ mfd[x].ufd[j].length=length; printf(\ scanf(\ strcpy(mfd[x].ufd[j].shuxing,prority); mfd[x].ufd[j].addr=rand(); mfd[x].uof[j].w=mfd[x].ufd[j].addr; strcpy(mfd[x].uof[j].state,\ printf(\ break; }/*else*/ }/*for*/ } /*================create=====================*/ /*================open()=====================*/ open(int x) { int j,k; char filename[20]; printf(\ printf(\ scanf(\ for(j=0;j { if(!strcmp(mfd[x].ufd[j].fname,filename))/*yi cun zai*/ {/*if*/ for(k=0;k if(strcmp(mfd[x].ufd[j].shuxing,\x].ufd[j].shuxing,\ { strcpy(mfd[x].uof[k].fname,filename); mfd[x].uof[k].length=mfd[x].ufd[j].length; strcpy(mfd[x].uof[k].shuxing,mfd[x].ufd[j].shuxing); strcpy(mfd[x].uof[k].state,\ mfd[x].uof[k].w=mfd[x].ufd[j].addr; mfd[x].uof[k].r=mfd[x].ufd[j].addr; printf(\ }/* da kai cheng gong*/ else printf(\ break; }/*bu zai uof*/ }/*for k*/ break; }/*if*/ else if(strlen(mfd[x].ufd[j].fname)==0) /*mei you gai wen jian*/ { printf(\ break; } }/*wai for*/ } /*=================open================*/ /*=================close()==============*/ close(int x) { int j; char filename[20]; printf(\ scanf(\ for(j=0;j if(!strcmp(mfd[x].uof[j].fname,filename))/*UOF zhong you*/ { if(!strcmp(mfd[x].uof[j].state,\ strcpy(mfd[x].uof[j].state,\ else strcpy(mfd[x].uof[j].fname,\ strcpy(mfd[x].uof[j].fname,\ strcpy(mfd[x].uof[j].shuxing,\ strcpy(mfd[x].uof[j].state,\ mfd[x].uof[j].length=0; printf(\ break; } else if(strlen(mfd[x].uof[j].fname)==0) { printf(\ break; } }/*for*/ } /*================close==================*/ /*================read()=================*/ Read(int x) { int j; int length; char filename[20]; printf(\ scanf(\ for(j=0;j if(!strcmp(mfd[x].uof[j].fname,filename))/*UOF zhong you*/ { if(!strcmp(mfd[x].uof[j].state,\ { printf(\ for(length=0;length else if(strlen(mfd[x].uof[j].fname)==0) { printf(\ break; } }/*for*/ } /*=====================read===================*/ /*====================write()===================*/ write(int x) { int j,k; char filename[20]; printf(\ printf(\ scanf(\ for(k=0;k