freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c語(yǔ)言文件系統(tǒng)設(shè)計(jì)—計(jì)算機(jī)畢業(yè)設(shè)計(jì)-資料下載頁(yè)

2024-11-23 21:22本頁(yè)面

【導(dǎo)讀】②列目錄時(shí)要列出文件名,物理地址,保護(hù)碼和文件長(zhǎng)度。③源文件可以進(jìn)行讀寫(xiě)保護(hù)。①首先應(yīng)確定文件系統(tǒng)的數(shù)據(jù)結(jié)構(gòu):主目錄、子目錄及活動(dòng)文件等。和子目錄都以文件的形式存放于磁盤,這樣便于查找和修改。②用戶創(chuàng)建的文件,可以編號(hào)存儲(chǔ)于磁盤上。

  

【正文】 cat(str,str1)。 fp_file=fopen(str,rb)。 fseek(fp_file,0,0)。 printf(\nThe text is:\n\n)。 printf( )。 while(fscanf(fp_file,%c,amp。c)!=EOF) if (c==39。\n39。) printf(\n )。 else printf(%c,c)。 printf(\n\n%d Length.\n,ufd[k]ufdfile[i].flength)。 fclose(fp_file)。 wgetchar=1。 } else {printf(\nError.\39。%s\39。 has been opened with WRITE ONLY mode. It isn\39。t read.\n,fname)。wgetchar=1。} } else {printf(\nError.\39。%s\39。 is in closing status. Please open it before read\n,fname)。wgetchar=1。} } else {printf(\nError. \39。%s\39。 does not exist.\n,fname)。wgetchar=1。} } } void WriteF() /*Write File*/ {int i,k,n=0。 char fname[MAXNAME]。 char str[50],str1[50],a[50]。 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)。 int WriteF1()。 /*write file*/ if (strcmp(strupr(ltrim(rtrim(dirname))),)==0) {printf(\nError. Please convert to ufd dir before write.\n)。wgetchar=1。return。} k=ExistD(dirname)。 printf(\nOpen File(s) with write only mode or read and write mode:\n)。/*display openned files with writable mode*/ for(i=0。ifcount[k]。i++) {if (ifopen[k][i].ifopen==1) if ((ifopen[k][i].openmode==1) ||(ifopen[k][i].openmode==2)) {printf(%15s,ufd[k]ufdfile[i].fname)。n++。} if((n%4==0)amp。amp。(n!=0)) printf(\n)。 } printf(\n%d files open.\n,n)。 if (n==0) wgetchar=1。 if(n!=0) {printf(\nPlease input FileName:)。 gets(fname)。 ltrim(rtrim(fname))。 i=ExistF(fname)。 if(i=0) {if(ifopen[k][i].ifopen==1) {if((ifopen[k][i].openmode==1) ||(ifopen[k][i].openmode==2)) {itoa(ufd[k]ufdfile[i].fpaddr,str,10)。 strcpy(str1,file)。 strcat(str1,str)。 strcpy(str,c:\\osfile\\file\\)。 strcat(str,str1)。 if (ufd[k]ufdfile[i].flength!=0) {printf(\n\39。%s\39。 has text. Overwrite or Append(Ooverwrite,AAppend,elsenot write):,fname)。 gets(a)。 ltrim(rtrim(a))。 if (fp_file!=NULL) fclose(fp_file)。 if (strcmp(strupr(a),O)==0) {printf(\nOverwrite\n)。 fp_file=fopen(str,wb)。 ufd[k]ufdfile[i].flength=0。 ufd[k]ufdfile[i].flength=WriteF1()。 } else if(strcmp(strupr(a),A)==0) {printf(\nAppend\n)。 fp_file=fopen(str,ab)。 ufd[k]ufdfile[i].flength=ufd[k]ufdfile[i].flength+WriteF1()。 } else {printf(\nError.\39。%s\39。 has not been written.\n,fname)。 fclose(fp_file)。 wgetchar=1。 } } else {fp_file=fopen(str,wb)。 ufd[k]ufdfile[i].flength=WriteF1()。 } } else {printf(\nError. \39。%s\39。 has been opened with read only isn\39。t writed.\n,fname)。wgetchar=1。} } else {printf(\nError. \39。%s\39。 is in closing status. Please open it before write\n,fname)。wgetchar=1。} } else {printf(\nError. \39。%s\39。 does not exist.\n,fname)。wgetchar=1。} } } void QuitF() /*Quit FileSystem*/ {int i,j。 char str[50]。 void SetPANo(int RorW)。 /*Set physical address num,0read,1write*/ SetPANo(1)。 if (fp_mfd!=NULL) fclose(fp_mfd)。 if (fp_ufd!=NULL) fclose(fp_ufd)。 if (fp_file!=NULL) fclose(fp_file)。 for(j=0。jucount。j++) {strcpy(str,c:\\osfile\\)。 strcat(str,ufd[j]ufdname)。 ltrim(rtrim(str))。 fp_ufd=fopen(str,wb)。 fclose(fp_ufd)。 fp_ufd=fopen(str,ab)。 for(i=0。ifcount[j]。i++) fwrite(amp。ufd[j]ufdfile[i],sizeof(OSFILE),1,fp_ufd)。 fclose(fp_ufd)。} } 文件系統(tǒng)設(shè)計(jì) 1. 文件系統(tǒng) ① 下列幾條命令 LOGIN 用戶登陸 DIR 列文件目錄 CREATE 創(chuàng)建文件 DELETE 刪除文件 OPEN 打開(kāi)文件 CLOSE 關(guān)閉文件 READ 讀文件 WRITE 寫(xiě)文件 ② 列目錄時(shí)要列出文件名,物理地址,保護(hù)碼和文件長(zhǎng)度。 ③ 源文件可以進(jìn)行讀寫(xiě)保護(hù)。 ①首先應(yīng)確定文件系統(tǒng)的數(shù)據(jù)結(jié)構(gòu):主目錄、子目錄及活動(dòng)文件等。主目錄和子目錄都以文件的形式存放于磁盤,這樣便于查找和修改。 ②用戶創(chuàng)建的文件,可以編號(hào)存 儲(chǔ)于磁盤上。如: file0,file1,file2…并以編號(hào)作為物理地址,在目錄中進(jìn)行登記。 程序見(jiàn)下(本程序需要在 c:下建一個(gè)名為 osfile 的目錄及一個(gè)名為 file的子目錄): include include include include define MAXNAME 25 /*the largest length of mfdname,ufdname,filename*/ define MAXCHILD 50 /*the largest child*/ define MAX (MAXCHILD*MAXCHILD) /*the size of fpaddrno*/ typedef struct /*the structure of OSFILE*/ {int fpaddr。 /*file physical address*/ int flength。 /*file length*/ int fmode。 /*file mode:0Read Only。1Write Only。2Read and Write(default)。*/ char fname[MAXNAME]。 /*file name*/ } OSFILE。 typedef struct /*the structure of OSUFD*/ {char ufdname[MAXNAME]。 /*ufd name*/ OSFILE ufdfile[MAXCHILD]。 /*ufd own file*/ }OSUFD。 typedef struct /*the structure of OSUFD39。LOGIN*/ {char ufdname[MAXNAME]。 /*ufd name*/ char ufdpword[8]。 /*ufd password*/ } OSUFD_LOGIN。 typedef struct /*file open mode*/ {int ifopen。 /*ifopen:0close,1open*/ int openmode。 /*0read only,1write only,2read and write,3initial*/ }OSUFD_OPENMODE。 OSUFD *ufd[MAXCHILD]。 /*ufd and ufd own files*/ OSUFD_LOGIN ufd_lp。 int ucount=0。 /*the count of mfd39。s ufds*/ int fcount[MAXCHILD]。 /*the count of ufd39。s files*/ int loginsuc=0。 /*whether login successfully*/ char username[MAXNAME]。 /*record login user39。s name22*/ char dirname[MAXNAME]。/*record current directory*/ int fpaddrno[MAX]。 /*record file physical address num*/ OSUFD_OPENMODE ifopen[MAXCHILD][MAXCHILD]。 /*record file open/close*/ int wgetchar。 /*whether getchar()*/ FILE *fp_mfd,*fp_ufd,*fp_file_p,*fp_file。 void main() {int i,j,choice1。 char choice[50]。 /*choice operation:dir,create,delete,open,delete,modify,read,write*/ int choiceend=1。 /*whether choice end*/ char *rtrim(char *str)。 /*remove the trailing blanks.*/ char *ltrim(char *str)。 /*remove the heading blanks.
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1