2022年操作系统-文件系统源代码 3

上传人:壹****1 文档编号:567313655 上传时间:2024-07-19 格式:PDF 页数:21 大小:106.06KB
返回 下载 相关 举报
2022年操作系统-文件系统源代码 3_第1页
第1页 / 共21页
2022年操作系统-文件系统源代码 3_第2页
第2页 / 共21页
2022年操作系统-文件系统源代码 3_第3页
第3页 / 共21页
2022年操作系统-文件系统源代码 3_第4页
第4页 / 共21页
2022年操作系统-文件系统源代码 3_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《2022年操作系统-文件系统源代码 3》由会员分享,可在线阅读,更多相关《2022年操作系统-文件系统源代码 3(21页珍藏版)》请在金锄头文库上搜索。

1、#include #include #include #include #define BLOCKSIZE 1024 #define SIZE 1024000 #define END 65535 #define FREE 0 #define ROOTBLOCKNUM 2 #define MAXOPENFILE 10 typedef struct FCB/unsigned char filename8; char exname3; unsigned char attribute; char reserve10;/me: 保留区(图 3-2 MS-DOS的文件控制块)unsigned short

2、time; unsigned short data; unsigned short first; unsigned long length; fcb; typedef struct FAT unsigned short id; fat; typedef struct USEROPEN fcb openfileMAXOPENFILE; char dirMAXOPENFILE80;/me: 用来记录每个打开文件所在的目录名,以方便用户打开不同目录下具有相同文件名的不同文件。/me: 即,相应打开文件所在的目录名,这样方便快速检查出指定文件是否已经打开int count; useropen; typ

3、edef struct BLOCK0 /* 引导块内容 */ char information200;/ 赋值 50 时本身已经越界unsigned char *startblock;/me: 虚拟磁盘上数据区开始位置block0; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 21 页 - - - - - - - - - unsigned char *myvhard; useropen *openfilelist; char currentdir80;/me: 记录当

4、前目录的目录名(包括目录的路径)unsigned char* startp;/me: 记录虚拟磁盘上数据区开始位置void initsys(); void format(); void startsys(); void exitsys(); void create(); int open(char *filename); void close(int fd); void mywrite(int fd,char *buff); void myread(int fd,char *buff); void deletefile(char *filename); void ls(); void list

5、openfile(); void cd(char *dirname); / 系统初始化:创建虚盘和格式化虚盘void initsys() myvhard=(unsigned char *)malloc(SIZE); memset(myvhard,0,SIZE); format(); void format() FILE *fp; time_t *now; struct tm *nowtime; unsigned char *p; fat *fat1,*fat2; fcb *root; int i,a; block0 *b0; now=(time_t *)malloc(sizeof(time_t

6、); p=myvhard; b0=(block0 *)p; strcpy(b0-information,My filesystem,version0.01,blocksize is 1K,whole size is 1000K,emulate FAT16,Max open file number is 10); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 21 页 - - - - - - - - - /printf(n %s,b0-information); p+=B

7、LOCKSIZE;/me: 将虚拟磁盘的第一块分配给了引导块/me: 给两个 FAT各分配两个盘块fat1=(fat *)(p); fat2=(fat *)(p+BLOCKSIZE*2); /me: 对于每个 FAT 中, 前面 5 个块设置为已分配,后面 995个块设置为空闲;/me: 即,将两个 fat 表的前 5 个表项的 id 赋值 END, 第 6 项为的 id 赋值 6 (指向虚拟磁盘的第 6 块(即根目录文件所在块) )fat1-id=END; fat2-id=END; fat1+; fat2+; fat1-id=END; fat2-id=END; fat1+; fat2+; f

8、at1-id=END; fat2-id=END; fat1+; fat2+; fat1-id=END; fat2-id=END; fat1+; fat2+; fat1-id=END; fat2-id=END; fat1+; fat2+; fat1-id=6; fat2-id=6; fat1+; fat2+; fat1-id=END; fat2-id=END; fat1+; fat2+; /me: 从第 7 个表项开始,初始化全部是空闲的for(i=7;ifilename,.); strcpy(root-exname,di); root-attribute=40;/me: 表示为目录文件time

9、(now); nowtime=localtime(now); root-time=nowtime-tm_hour*2048+nowtime-tm_min*32+nowtime-tm_sec/2; root-data=(nowtime-tm_year-80)*512+(nowtime-tm_mon+1)*32+nowtime-tm_mday; root-first=5; root-length=2*sizeof(fcb); root+; strcpy(root-filename,.); strcpy(root-exname,di); root-attribute=40; time(now); n

10、owtime=localtime(now); root-time=nowtime-tm_hour*2048+nowtime-tm_min*32+nowtime-tm_sec/2; root-data=(nowtime-tm_year-80)*512+(nowtime-tm_mon+1)*32+nowtime-tm_mday; root-first=5; root-length=2*sizeof(fcb); root+; for(i=2;ifilename0=0; a =BLOCKSIZE*2/sizeof(fcb); fp=fopen(c:myfsys,w); b0-startblock=p+

11、BLOCKSIZE*4;/me: 虚拟磁盘上数据区开始位置fwrite(myvhard,SIZE,1,fp); fclose(fp); free(myvhard); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 21 页 - - - - - - - - - / 格式化之后填充初始内容void startsys() FILE *fp; int i; openfilelist=(useropen *)malloc(sizeof(useropen); memset(openf

12、ilelist,0,sizeof(useropen); fp=fopen(c:myfsys,r); myvhard=(unsigned char *)malloc(SIZE); memset(myvhard,0,SIZE); fread(myvhard,SIZE,1,fp); strcpy(openfilelist-openfile0.filename,root); strcpy(openfilelist-openfile0.exname,di); openfilelist-openfile0.attribute=168; openfilelist-openfile0.time=(fcb *)

13、(myvhard+5*BLOCKSIZE)-time; openfilelist-openfile0.data=(fcb *)(myvhard+5*BLOCKSIZE)-data; openfilelist-openfile0.first=(fcb *)(myvhard+5*BLOCKSIZE)-first; openfilelist-openfile0.length=(fcb *)(myvhard+5*BLOCKSIZE)-length; openfilelist-count=1; strcpy(currentdir,root); strcpy(openfilelist-dir0,curre

14、ntdir); for(i=6;istartblock; fclose(fp); void exitsys() FILE *fp; fp=fopen(c:myfsys,w); fwrite(myvhard,SIZE,1,fp); free(myvhard); free(openfilelist); fclose(fp); / 创建文件或目录void create() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 21 页 - - - - - - - - - time_t

15、 *now; struct tm *nowtime; char current8; fcb *freefcb,*updir,*p;/me: 前者指向分配的空闲FCB , 后者指向自身在其父目录的 fcb 位置int i,j,k,m,flag,b; unsigned short index; fat *fat1,*fat2,*fatcurrent1,*fatcurrent2; now=(time_t *)malloc(sizeof(time_t); if(openfilelist-count=MAXOPENFILE) printf(open too many files!n); return;

16、flag=0; /me: 找到当前所在目录for(i=80;i=0;i-) if(currentdiri=) flag+; if(flag=2) break; i+; /me: 找到当前目录的上一目录for(j=0;currentdiri!=;i+,j+) currentj=currentdiri; currentj=0; /me: 通过检查 attribute 位的末三位是不是8 来确定文件类型(目录文件还是数据文件)for(i=0;iopenfilei.attribute & 8)=8) break; fat1=(fat *)(myvhard+BLOCKSIZE); index=openf

17、ilelist-openfilei.first; freefcb=(fcb *)(myvhard+openfilelist-openfilei.first*BLOCKSIZE); for(m=0;mopenfilei.length/BLOCKSIZE+1;m+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 21 页 - - - - - - - - - for(j=0;jfilename0=0) break; freefcb+; if(j=32) freefcb=(fc

18、b *)(myvhard+fat1index.id); index=fat1index.id; if(strcmp(currentdir,root)!=0) updir=(fcb *)(myvhard+openfilelist-openfilei.first*BLOCKSIZE); if(j=openfilelist-openfilei.length/32) for(k=0;kopenfilei.length/32;j+) if(strcmp(updir-filename,.)=0) break; updir+; fat1=(fat *)(myvhard+BLOCKSIZE); fat2=(f

19、at *)(myvhard+BLOCKSIZE*3); for(m=7;mid=FREE) break; fat1+; fat2+; fatcurrent1=(fat *)(myvhard+BLOCKSIZE); fatcurrent2=(fat *)(myvhard+BLOCKSIZE*3); index=openfilelist-openfilei.first; while(fatcurrent1index.id!=END) index=fatcurrent1index.id; if(m=SIZE/BLOCKSIZE) 名师资料总结 - - -精品资料欢迎下载 - - - - - - -

20、- - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 21 页 - - - - - - - - - printf(cant creat filen); return; fatcurrent1index.id=m; fatcurrent2index.id=m; fatcurrent1m.id=END; fatcurrent2m.id=END; for(k=0;klength/32;k+) if(strcmp(updir-filename,currentdir)=0) break; updir+; fat1=(fat *)(myvhard+BLOCK

21、SIZE); fat2=(fat *)(myvhard+BLOCKSIZE*3); for(m=0;mid=FREE) break; fat1+; fat2+; fat1-id=END; fat2-id=END; updir=(fcb *)(myvhard+openfilelist-openfilei.first*BLOCKSIZE); updir-length+=sizeof(fcb); updir+; updir-length+=sizeof(fcb); updir-; for(k=0;kopenfilei.length/32;j+) if(strcmp(updir-filename,.)

22、=0) break; updir+; updir=(fcb *)(myvhard+updir-first*BLOCKSIZE); for(k=0;klength/32;k+) if(strcmp(updir-filename,currentdir)=0) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 21 页 - - - - - - - - - break; updir+; updir-length+=sizeof(fcb); else updir=(fcb *)(my

23、vhard+openfilelist-openfilei.first*BLOCKSIZE); updir-length+=sizeof(fcb); updir+; updir-length+=sizeof(fcb); fat1=(fat *)(myvhard+BLOCKSIZE); fat2=(fat *)(myvhard+BLOCKSIZE*3); for(m=0;mid=FREE) break; fat1+; fat2+; fat1-id=END; fat2-id=END; openfilelist-openfilei.length+=sizeof(fcb); printf(please

24、input filename:); scanf(%s,freefcb-filename); printf(please input filetype:); scanf(%s,freefcb-exname); freefcb-attribute=0; if(strcmp(freefcb-exname,di)=0) freefcb-attribute +=8; p=(fcb *)(myvhard+m*BLOCKSIZE); strcpy(p-filename,.); strcpy(p-exname,di); p-attribute=40; time(now); nowtime=localtime(

25、now); p-time=nowtime-tm_hour*2048+nowtime-tm_min*32+nowtime-tm_sec/2; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 21 页 - - - - - - - - - p-data=(nowtime-tm_year-80)*512+(nowtime-tm_mon+1)*32+nowtime-tm_mday; p-first=m; p-length=2*sizeof(fcb); p+; strcpy(p-fi

26、lename,.); strcpy(p-exname,di); p-attribute=40; time(now); nowtime=localtime(now); p-time=nowtime-tm_hour*2048+nowtime-tm_min*32+nowtime-tm_sec/2; p-data=(nowtime-tm_year-80)*512+(nowtime-tm_mon+1)*32+nowtime-tm_mday; p-first=openfilelist-openfilei.first; p-length=2*sizeof(fcb); freefcb-length=2*siz

27、eof(fcb); printf(is this file readonly?(1 or 0); scanf(%d,&b); if(b=1) freefcb-attribute +=128; printf(is this file hide?(1 or 0); scanf(%d,&b); if(b=1) freefcb-attribute +=64; printf(is this file system?(1 or 0); scanf(%d,&b); if(b=1) freefcb-attribute +=32; time(now); nowtime=localtime(now); freef

28、cb-time=nowtime-tm_hour*2048+nowtime-tm_min*32+nowtime-tm_sec/2; freefcb-data=(nowtime-tm_year-80)*512+(nowtime-tm_mon+1)*32+nowtime-tm_mday; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 21 页 - - - - - - - - - freefcb-first=m; if(freefcb-attribute & 8)!=8) f

29、reefcb-length=0; open(freefcb-filename); void ls() int i,l; fcb *current; for(i=0;iopenfilei.attribute & 8)=8) break; current=(fcb *)(myvhard+openfilelist-openfilei.first*BLOCKSIZE); l=openfilelist-openfilei.length/sizeof(fcb); for(i=0;ifilename,current-exname,current-time/2048,(current-time%2048)/3

30、2,(current-time%32)*2,current-data/512+1980,current-data%512/32, current-data%32,current-length); void listopenfile() int i; for(i=0;icount;i+) printf(%d.%s%s.%sn,i,openfilelist-diri,openfilelist-openfilei.filename,openfilelist-openfilei.exname); int open(char *filename) int i,m,j,index,flag; fat *f

31、at1; fcb *nowfile; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 21 页 - - - - - - - - - flag=0; if(openfilelist-count=MAXOPENFILE) printf(open too many files!n); return -1; for(i=0;iopenfilei.attribute & 8)=8) break; fat1=(fat *)(myvhard+BLOCKSIZE); index=ope

32、nfilelist-openfilei.first; nowfile=(fcb *)(myvhard+openfilelist-openfilei.first*BLOCKSIZE); for(m=0;mopenfilei.length/BLOCKSIZE+1;m+) for(j=0;jfilename,filename)=0) flag=1; break; nowfile+; if(j=32) nowfile=(fcb *)(myvhard+fat1index.id); index=fat1index.id; if(flag=0) printf(file %s doesnt existn,fi

33、lename); return -1; strcpy(openfilelist-openfileopenfilelist-count.filename,nowfile-filename); strcpy(openfilelist-openfileopenfilelist-count.exname,nowfile-exname); openfilelist-openfileopenfilelist-count.attribute=nowfile-attribute; openfilelist-openfileopenfilelist-count.time=nowfile-time; openfi

34、lelist-openfileopenfilelist-count.data=nowfile-data; openfilelist-openfileopenfilelist-count.first=nowfile-first; openfilelist-openfileopenfilelist-count.length=nowfile-length; strcpy(openfilelist-diropenfilelist-count,currentdir); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - -

35、- - - - - 第 12 页,共 21 页 - - - - - - - - - openfilelist-count+; listopenfile(); return openfilelist-count-1; void close(int fd) int i; if(fd=openfilelist-count) printf(file doesnt existn); return; for(i=fd;icount-1;i+) strcpy(openfilelist-openfilei.filename,openfilelist-openfilei+1.filename); strcpy(

36、openfilelist-openfilei.exname,openfilelist-openfilei+1.exname); openfilelist-openfilei.attribute=openfilelist-openfilei+1.attribute; openfilelist-openfilei.time=openfilelist-openfilei+1.time; openfilelist-openfilei.data=openfilelist-openfilei+1.data; openfilelist-openfilei.first=openfilelist-openfil

37、ei+1.first; openfilelist-openfilei.length=openfilelist-openfilei+1.length; strcpy(openfilelist-diri,openfilelist-diri+1); openfilelist-count-; / 写文件void mywrite(int fd,char *buff) unsigned char *p; int i,j,newid,index,size1,size2,size; fcb *temp; fat *fat1,*fat2; char dir10,*q; if(fd=openfilelist-co

38、unt) printf(file doesnt existn); return; if(openfilelist-openfilefd.attribute&8)=8) printf(file is a dirfile cant writen); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 21 页 - - - - - - - - - return; / 写入的文字长度需要增加一个数据块if(openfilelist-openfilefd.length/BLOCKSI

39、ZE !=(openfilelist-openfilefd.length+strlen(buff)/BLOCKSIZE) fat1=(fat *)(myvhard+BLOCKSIZE); fat2=(fat *)(myvhard+3*BLOCKSIZE); for(i=7;iid=FREE) break; fat1+; fat2+; if(i=SIZE/BLOCKSIZE) printf(the hard disk is fulln); return; fat1-id=END; fat2-id=END; newid=i-1; fat1=(fat *)(myvhard+BLOCKSIZE); f

40、at2=(fat *)(myvhard+BLOCKSIZE*3); index=openfilelist-openfilefd.first; while(fat1index.id!=END) index=fat1index.id; fat1index.id=newid; fat2index.id=newid; size1=BLOCKSIZE-openfilelist-openfilefd.length%BLOCKSIZE; size2=strlen(buff)-size1; p=myvhard+index*BLOCKSIZE+openfilelist-openfilefd.length%BLO

41、CKSIZE; for(j=0;jsize1;j+) *p=buffj; p+; p=myvhard+newid*BLOCKSIZE; for(j=0;jopenfilefd.first; while(fat1index.id!=END) index=fat1index.id; p=myvhard+index*BLOCKSIZE+openfilelist-openfilefd.length%BLOCKSIZE; for(j=0;j length; for(q=openfilelist-dirfd;*q!=0;q+) if(*q!=) dirj=*q; j+; else dirj=0; for(

42、i=0;ifilename)=0) break; temp+; temp=(fcb *)(myvhard+temp-first*BLOCKSIZE); size=temp-length; j=0; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 15 页,共 21 页 - - - - - - - - - for(i=0;iopenfilefd.filename,temp-filename)=0) break; temp+; temp-length+=strlen(buff); ope

43、nfilelist-openfilefd.length=strlen(buff); / 读取文件内容void myread(int fd,char *buff) unsigned char *p; int n,index,i,length,j,k; fat *fat1; fat1=(fat *)(myvhard+BLOCKSIZE); index=openfilelist-openfilefd.first; p=myvhard+openfilelist-openfilefd.first*BLOCKSIZE; n=openfilelist-openfilefd.length/BLOCKSIZE+

44、1; length=openfilelist-openfilefd.length; k=0; for(i=0;in;i+) for(j=0;jBLOCKSIZE &k length;j+,k+) buffk=*p; p+; p=myvhard+BLOCKSIZE*(fat1index.id); index=fat1index.id; buffk=0; / 进入 dirname 目录void cd(char *dirname) int i,index,j,k,length,count,m,n; unsigned char *p; char *updir; fcb *nowfile; fat *f

45、at1; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 16 页,共 21 页 - - - - - - - - - count=0; updir = (char*)malloc(sizeof(char) * 80); for(i=0;icount;i+) if(openfilelist-openfilei.attribute & 8)=8) break; if(i=openfilelist-count) printf(dir doesnt existn); return; fat1

46、=(fat *)(myvhard+BLOCKSIZE); index=openfilelist-openfilei.first; p=myvhard+openfilelist-openfilei.first*BLOCKSIZE; nowfile=(fcb *)p; length=openfilelist-openfilei.length; for(j=0;jopenfilei.length/sizeof(fcb);j+) if(j!=0 & j%32=0) nowfile=(fcb *)(myvhard+fat1index.id); index=fat1index.id; else if(st

47、rcmp(nowfile-filename,dirname)=0 & (nowfile-attribute & 8)=8) break; nowfile+; if(j=openfilelist-openfilei.length/sizeof(fcb) printf(dir doesnt existn); return; if(strcmp(dirname,.)!=0 & strcmp(dirname,.)!=0) strcpy(openfilelist-openfileopenfilelist-count.filename,nowfile-filename); strcpy(openfilel

48、ist-openfileopenfilelist-count.exname,nowfile-exname); openfilelist-openfileopenfilelist-count.attribute=nowfile-attribute; openfilelist-openfileopenfilelist-count.time=nowfile-time; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 17 页,共 21 页 - - - - - - - - - openfil

49、elist-openfileopenfilelist-count.data=nowfile-data; openfilelist-openfileopenfilelist-count.first=nowfile-first; openfilelist-openfileopenfilelist-count.length=nowfile-length; strcpy(openfilelist-diropenfilelist-count,currentdir); openfilelist-count+; else if(strcmp(dirname,.)=0 & strcmp(currentdir,

50、root)!=0)/root/ count=0; for(k=80;k0;k-) if(currentdirk= & count=2) break; else if(currentdirk=) count+; updir0 = currentdirk; k+; for(n=1;(kopenfileopenfilelist-count.filename,updir+1); strcpy(openfilelist-openfileopenfilelist-count.exname,nowfile-exname); openfilelist-openfileopenfilelist-count.at

51、tribute=nowfile-attribute; openfilelist-openfileopenfilelist-count.time=nowfile-time; openfilelist-openfileopenfilelist-count.data=nowfile-data; openfilelist-openfileopenfilelist-count.first=nowfile-first; openfilelist-openfileopenfilelist-count.length=nowfile-length; updirn=currentdirk; updirn+1=0;

52、 strcpy(openfilelist-diropenfilelist-count,updir); openfilelist-count+; if(strcmp(currentdir,root)=0 & (strcmp(dirname,.)=0 | strcmp(dirname,.)=0)/;/root/ else count=0; if(strcmp(dirname,.)=0) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 18 页,共 21 页 - - - - - - - -

53、 - for(k=80;k0;k-) if(currentdirk= & count=1) break; else if(currentdirk=) count+; currentdirk+1=0; else if(strcmp(dirname,.)=0); else m=0; for(k=80;k0;k-) if(currentdirk=) break; for(k=k+1;dirnamem!=0;k+,m+) currentdirk=dirnamem; currentdirk=; currentdirk+1=0; close(i); /close(i); listopenfile(); v

54、oid deletefile(char *filename) int i,index,j,k,index1; /char *updir;m,length,n, fcb *p; fat *fat1,*fat2; for(i=0;icount;i+) if(openfilelist-openfilei.attribute & 8)=8) break; p=(fcb *)(myvhard+openfilelist-openfilei.first); for(j=0;jopenfilei.length/sizeof(fcb);j+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - -

55、 - - - - - - - - - - - 名师精心整理 - - - - - - - 第 19 页,共 21 页 - - - - - - - - - if(strcmp(filename,p-filename)=0) break; p+; if(j=openfilelist-openfilei.length/sizeof(fcb) printf(file doesnt exist cant deleten); return; for(k=0;kcount;k+) if(strcmp(openfilelist-dirk,currentdir)=0 & strcmp(filename,openf

56、ilelist-openfilek.filename)=0) break; if(k!=openfilelist-count) close(k); fat1=(fat *)(myvhard+BLOCKSIZE); fat2=(fat *)(myvhard+3*BLOCKSIZE); index=p-first; while(fat1index.id!=END) index1=index; index=fat1index.id; fat1index1.id=FREE; fat2index1.id=FREE; p-filename0=0; p=(fcb *)(myvhard+openfilelis

57、t-openfilei.first); p-length-=sizeof(fcb); void main() int fd; char buff1000,buff11000,dirname10; printf(FCB_size=%dn,sizeof(fcb); initsys(); / clrscr(); startsys(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 20 页,共 21 页 - - - - - - - - - ls(); create(); create()

58、; ls(); listopenfile(); printf(please input the file id:); scanf(%d,&fd); printf(please input text:); scanf(%s,buff); mywrite(fd,buff); ls(); listopenfile(); printf(please input the file id:); scanf(%d,&fd); myread(fd,buff1); printf(%sn,buff1); printf(please input the dir name:); scanf(%s,dirname); cd(dirname); create(); ls(); cd(.); exitsys(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 21 页,共 21 页 - - - - - - - - -

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号