c语言文件系统设计—计算机毕业设计内容摘要:
name),CD..)==0) strcpy(ltrim(rtrim(dirname)),)。 else printf(\nError.\39。 %s\39。 does not exist.\n,dname)。 } void CreateF() /*Create File*/ {int fpaddrno,flag=1,i。 char fname[MAXNAME],str[50],str1[50],strtext[255],a[25]。 char fmode[25]。 char *rtrim(char *str)。 /*remove the trailing blanks.*/ char *ltrim(char *str)。 /*remove the heading blanks.*/ int FindPANo()。 /*find out physical address num*/ int WriteF1()。 /*write file*/ int ExistF(char *filename)。 /*Whether FileName Exist,Existi,Not Exist0*/ int ExistD(char *dirname)。 if (strcmp(strupr(dirname),strupr(username))!=0) {printf(\nError. You must create file in your own dir.\n)。 wgetchar=1。 } else { printf(\nPlease input FileName:)。 gets(fname)。 ltrim(rtrim(fname))。 if (ExistF(fname)=0) {printf(\nError. Name \39。 %s\39。 has already existed.\n,fname)。 wgetchar=1。 } else {printf(Please input FileMode(0Read Only, 1Write Only, 2Read and Write, 3Protect):)。 gets(fmode)。 ltrim(rtrim(fmode))。 if((strcmp(fmode,0)==0)||(strcmp(fmode,1)==0)||(strcmp(fmode,2)==0)||(strcmp(fmode,3)==0)) {fpaddrno=FindPANo()。 if (fpaddrno=0) {i=ExistD(username)。 strcpy(ufd[i]ufdfile[fcount[i]].fname,fname)。 ufd[i]ufdfile[fcount[i]].fpaddr=fpaddrno。 ufd[i]ufdfile[fcount[i]].fmode=atoi(fmode)。 ifopen[i][fcount[i]].ifopen=0。 ifopen[i][fcount[i]].openmode=4。 strcpy(str,c:\\osfile\\file\\file)。 itoa(fpaddrno,str1,10)。 strcat(str,str1)。 fp_file=fopen(str,wb)。 fclose(fp_file)。 fcount[i]++。 while(flag) {printf(Input text now(Y/N):)。 gets(a)。 ltrim(rtrim(a))。 ufd[i]ufdfile[fcount[i]1].flength=0。 if(strcmp(strupr(a),Y)==0) {fp_file=fopen(str,wb+)。 ufd[i]ufdfile[fcount[i]1].flength=WriteF1()。 flag=0。 } else if(strcmp(strupr(a),N)==0){flag=0。 wgetchar=1。 } } printf(\n\39。 %s\39。 has been created successfully!\n,fname)。 } else {printf(\nFail!No Disk Space. Please format your disk.\n)。 wgetchar=1。 } } else {printf(\nError. FileMode\39。 s Range is 03\n)。 wgetchar=1。 } }} } int ExistF(char *filename) /*Whether FileName Exist,Existi,Not Exist0*/ {int i,j。 int exist=0。 int ExistD(char *dirname)。 j=ExistD(dirname)。 for(i=0。 ifcount[j]。 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。 iMAX。 i++) if (fpaddrno[i]==0) {fpaddrno[i]=1。 break。 } if (iMAX) return(i)。 else return(1)。 } int WriteF1() /*write file*/ {int length=0。 char c。 printf(Please input text(\39。 \39。 stands for end):\n)。 while((c=getchar())!=39。 39。 ) {fprintf(fp_file,%c,c)。 if (c!=39。 \n39。 ) length++。 } fprintf(fp_file,\n)。 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,Existi,Not Exist0*/ int ExistD(char *dirname)。 if (strcmp(strupr(dirname),strupr(username))!=0) {printf(\nError. You can only delete file in your own dir.\n)。 wgetchar=1。 } else {printf(\nPlease input FileName:)。 gets(fname)。 ltrim(rtrim(fname))。 i=ExistF(fname)。 if (i=0) {k=ExistD(username)。 if(ifopen[k][i].ifopen==1) {printf(\nError. \39。 %s\39。 is in open status. Close it before delete.\n,fname)。 wgetchar=1。 } else { while(flag) {printf(\39。 %s\39。 will be deleted. Are you sure(Y/N):,fname)。 gets(a)。 ltrim(rtrim(a))。 if(strcmp(strupr(a),Y)==0) {fpaddrno[ufd[k]ufdfile[i].fpaddr]=0。 itoa(ufd[k]ufdfile[i].fpaddr,str,10)。 for(j=i。 jfcount[k]1。 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,c:\\osfile\\file\\file)。 strcat(str1,str)。 remove(str1)。 flag=0。 printf(\n\39。 %s\39。 has been deleted successfully.\n,fname)。 wgetchar=1。 } else if(strcmp(strupr(a),N)==0) {printf(\nError. \39。 %s\39。 hasn\39。 t been deleted.\n,fname)。 wgetchar=1。 flag=0。 } }}} else {printf(\nError. \39。 %s\39。 does not exist.\n,fname)。 wgetchar=1。 }} } 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 39。 *39。 replace*/ void SetPANo(int RorW)。 /*Set physical address num*/ int ExistF(char *filename)。 /*Whether FileName Exist,Existi,Not Exist0*/ int ExistD(char *dirname)。 if (strcmp(strupr(dirname),strupr(username))!=0) {printf(\ can only modify filemode in yourself dir.\n)。 wgetchar=1。 } else { printf(\nPlease input FileName:)。 gets(fname)。 ltrim(rtrim(fname))。 i=ExistF(fname)。 if (i=0) {k=ExistD(username)。 if(ifopen[k][i].ifopen==1) {printf(\nError.\39。 %s\39。 is in open status. Close it before modify.\n,fname)。 wgetchar=1。 } else { if(ufd[k]ufdfile[i].fmode==0) strcpy(str,read only)。 /*FileMode*/ else if(ufd[k]ufdfile[i].fmode==1) strcpy(str,write only)。 else if(ufd[k]ufdfile[i].fmode==2) strcpy(str,read and write)。 else strcpy(str,Protect)。 printf(\39。 %s\39。 filemode is %s.\n,fname,strupr(str))。 print。c语言文件系统设计—计算机毕业设计
相关推荐
设项目建筑面积 500m2;道孚县妇幼保健 院建设项目总面积 201Xm2;道孚县文化馆建设项目业务用房总 建筑面积 201Xm2;道孚县图书馆建设项 目业务用房总建筑面积 201Xm2;道孚县 唐卡绘画产业发展及艺 术传习中心工程建筑面 积 600m;道孚县电 视台演播综合楼建设项 目建筑面积1500m;道孚县全民健身活动 中心建设项目及配套体
充分的了解 ,那对您所设计程序的可重用性 ,可维护性和其他各方面的质量都会有大 幅 度提高。 支持多种关系数据库管理系统 用 PowerBuilder 开发的应用程序可以同时访问多个数据库系统,比如说,可以从Oracle 中查询数据,然后将结果放入到 Foxpro 中。 PowerBuilder 支持多种关系数据库管理系统( RDBMS),既包括诸如 Oracle、 Sybase、
流堰 ,同时在溢流堰下方设置一个紧急出水口,用闸门封住,它主要是用于检修时紧急排水。 在溢流堰后设置集水渠,统一出水。 由于设计中采用两组氧化沟并联运行,配水方式也是采用配水渠的方式,但是在配水渠与单组进水口处设置一个闸门,主要是方便检修,一旦一个池子中出现问题可以放下闸门,将池中水从紧急出水口排出。 氧化沟的曝气装置 曝气设备对氧化沟的处理效率,能耗及处理稳定性有关键性影响
内文件一般文字在前,图样在后;译文在前,原文在后;正件在前,附件在后;印件在前,定 (草 )稿在后. 7. 4 案卷编目 7. 4. 1 卷内文件页号的编写 卷内文件有书写内容的页面均应编写页号;页号编写位置:单面书写文件在右下角;双 面书写文件,正面在右下角,背面在左下角;图样的页号编写在右下角,或标题栏外右上方; 成套图样或印刷成册文件,不必重新编写页号:各卷之间不连续编页号. 7. 4.
ng. For example, if the sprinkler system fails the occupants will be protected with passive protection and smoke control systems. The following sections discuss the three building height limits with
公通字 )〔 2020〕 46号文 的出台,无机保温材料市场火爆。 玻化微珠砂浆原料供不应求,原料价格甚至翻了 一倍之多。 但是保温效果并不良好。 随后出来的产品有 泡沫玻璃、泡沫铝、泡沫陶瓷,岩棉矿棉等纤维保温材料虽然防火性能可达到要求,但综合考虑价格,施工可操作性,环保节能等因素,都无法成为保温材料市场主流产品。 新型建筑保温材料研究与开发,已引起国家相关部门的重视。