操作系统2014课程设计(6)
ufd[i]->ufdfile[fcount[i]-1].flength=WriteF1(); flag=0; }
else if(strcmp(strupr(a),\ }
printf(\ } else
{printf(\ }
else {printf(\ }} }
int ExistF(char *filename) /*Whether FileName Exist,Exist-i,Not Exist-0*/ {int i,j; int exist=0;
int ExistD(char *dirname); j=ExistD(dirname); for(i=0;i if (strcmp(strupr(ufd[j]->ufdfile[i].fname),strupr(filename))==0) {exist=1; break; } if (exist) return(i); else return(-1); } int FindPANo() /*find out physical address num*/ {int i; for(i=0;i if (fpaddrno[i]==0) {fpaddrno[i]=1;break;} if (i int WriteF1() /*write file*/ {int length=0; char c; printf(\ while((c=getchar())!='#') {fprintf(fp_file,\ if (c!='\\n') length++; } fprintf(fp_file,\ fclose(fp_file); return(length); } void DeleteF() /*Delete File*/ {char fname[MAXNAME]; char str[50],str1[50]; int i,j,k,flag=1; char a[25]; /*whether delete*/ char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ int ExistF(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ int ExistD(char *dirname); if (strcmp(strupr(dirname),strupr(username))!=0) {printf(\ else {printf(\ gets(fname); ltrim(rtrim(fname)); i=ExistF(fname); if (i>=0) {k=ExistD(username); if(ifopen[k][i].ifopen==1) {printf(\delete.\\n\ else { while(flag) {printf(\gets(a); ltrim(rtrim(a)); if(strcmp(strupr(a),\ {fpaddrno[ufd[k]->ufdfile[i].fpaddr]=0; itoa(ufd[k]->ufdfile[i].fpaddr,str,10); for(j=i;j {strcpy(ufd[k]->ufdfile[j].fname,ufd[k]->ufdfile[j+1].fname); ufd[k]->ufdfile[j].fpaddr=ufd[k]->ufdfile[j+1].fpaddr; ufd[k]->ufdfile[j].flength=ufd[k]->ufdfile[j+1].flength; ufd[k]->ufdfile[j].fmode=ufd[k]->ufdfile[j+1].fmode; ifopen[k][j]=ifopen[k][j+1]; } fcount[k]--; strcpy(str1,\ strcat(str1,str); remove(str1); flag=0; printf(\wgetchar=1; } else if(strcmp(strupr(a),\ {printf(\ wgetchar=1; flag=0;} }}} else {printf(\} void ModifyFM() /*Modify FileMode*/ {char fname[MAXNAME],str[50]; int i,j,k,flag; char fmode[25]; /*whether delete*/ char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ void InputPW(char *password); /*input password,use '*' replace*/ void SetPANo(int RorW); /*Set physical address num*/ int ExistF(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ int ExistD(char *dirname); if (strcmp(strupr(dirname),strupr(username))!=0) {printf(\modify filemode in yourself dir.\\n\ else { printf(\ gets(fname); ltrim(rtrim(fname)); i=ExistF(fname); if (i>=0) {k=ExistD(username); if(ifopen[k][i].ifopen==1) {printf(\modify.\\n\ else { if(ufd[k]->ufdfile[i].fmode==0) strcpy(str,\ else if(ufd[k]->ufdfile[i].fmode==1) strcpy(str,\ else if(ufd[k]->ufdfile[i].fmode==2) strcpy(str,\ else strcpy(str,\ printf(\ printf(\ gets(fmode); ltrim(rtrim(fmode)); if(strcmp(fmode,\ {ufd[k]->ufdfile[i].fmode=0; printf(\wgetchar=1; } else if(strcmp(fmode,\ {ufd[k]->ufdfile[i].fmode=1; printf(\wgetchar=1; } else if(strcmp(fmode,\ {ufd[k]->ufdfile[i].fmode=2; printf(\wgetchar=1; } else if(strcmp(fmode,\ {ufd[k]->ufdfile[i].fmode=3; printf(\wgetchar=1; } else {printf(\ } } else {printf(\} void OpenF() /*Open File*/ {char fname[MAXNAME]; char str[25],str1[25],fmode[25]; int i,k; char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ int ExistF(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ int ExistD(char *dirname); if (strcmp(strupr(ltrim(rtrim(dirname))),\ {printf(\ printf(\ gets(fname); ltrim(rtrim(fname)); i=ExistF(fname); if (i>=0) {k=ExistD(dirname); if(!ifopen[k][i].ifopen) {if (ufd[k]->ufdfile[i].fmode==3) {printf(\ else {printf(\input FileOpenMode(0-Read Only,1-Write Only,2-Read and Write):\ gets(fmode); ltrim(rtrim(fmode)); if((strcmp(fmode,\ {if(fmode[0]=='0') /*open file with read only mode*/ {strcpy(str,\ if((ufd[k]->ufdfile[i].fmode==0)||(ufd[k]->ufdfile[i].fmode==2)) ifopen[k][i].ifopen=1; } else if(fmode[0]=='1') /*open file with write only mode*/ {strcpy(str,\ if((ufd[k]->ufdfile[i].fmode==1)||(ufd[k]->ufdfile[i].fmode==2)) ifopen[k][i].ifopen=1; } else if(fmode[0]=='2') /*open file with read and write mode*/ {strcpy(str,\ if(ufd[k]->ufdfile[i].fmode==2) ifopen[k][i].ifopen=1; } if(ufd[k]->ufdfile[i].fmode==0) strcpy(str1,\ else if(ufd[k]->ufdfile[i].fmode==1) strcpy(str1,\ else if(ufd[k]->ufdfile[i].fmode==2) strcpy(str1,\ if(ifopen[k][i].ifopen==1) {ifopen[k][i].openmode=atoi(fmode); if (ifopen[k][i].openmode==0) strcpy(str,\ else if(ifopen[k][i].openmode==1) strcpy(str,\ else if(ifopen[k][i].openmode==2) strcpy(str,\ printf(\is %s\\n\ wgetchar=1; } else {printf(\FileMode is %s\\n\ } else {printf(\ }}
相关推荐:
- [政务民生]2013年公共基础知识热点问题(七)
- [政务民生]检验检测机构资质认定评审准则及释义20
- [政务民生]关于印发重庆市房屋建筑和市政基础设施
- [政务民生]1、隧道洞身开挖支护施工技术交底书
- [政务民生]2015年山东省17地市中考语文试题分类汇
- [政务民生]2-高级会计师资格考试和评审流程图
- [政务民生]2018版中国清分机行业发展分析及前景策
- [政务民生]新课改高中政治探究
- [政务民生]2018-2024年中国新型组合房屋行业投资
- [政务民生]2015年上海市春季高考数学模拟试卷五
- [政务民生]灌砂法及环刀法测压实度(带计算过程)
- [政务民生]运筹学实验2求解非线性规划
- [政务民生]劝学、逍遥游默写(教师卷)
- [政务民生]《运筹学》 - 期末考试 - 试卷A - 答案
- [政务民生]八年级英语下册 Module 6 Hobbies测试
- [政务民生]2019年宪法知识竞赛试题库100题(含答
- [政务民生]自动化英文文献翻译
- [政务民生]公文格式实施细则
- [政务民生]高一地理上册课堂跟踪练习题6
- [政务民生]会计继续教育习题及答案
- 第三章 无约束最优化方法
- 泛读教程第三册答案
- 魏晋南北朝文学
- 幂的运算复习题
- 城市环境问题的成因与治理策略_以社会
- 钢结构行业产业链及竞争分析研究
- 新型热塑性弹性体增韧聚丙烯的研究
- 中国旅游地理B卷试题及答案
- (苏教版)五年级数学上册第三单元测试卷
- 不稳定性心绞痛诊断与治疗
- 俞氏国际后勤职能部门绩效考核办法
- GB7258-2017新标准考试题含答案
- 小学生汉字听写比赛活动方案
- 1.3《平抛运动》学案 教科版必修2
- 2011香港特别行政区公务员考试复习资料
- 考虑水力条件变化的城市给水管网可靠性
- 表面活性剂在油田开发和生产中的应用
- ITT内部培训资料-FI端吸泵的介绍
- 文明守纪,从我做起学生发言稿
- 初中读《聊斋志异》心得体会800字范文




