教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 政务民生 >

操作系统2014课程设计(7)

来源:网络收集 时间:2026-07-24
导读: else {printf(\ } else {printf(\} void CloseF() /*Close File*/ {int i,k,n=0; char fname[MAXNAME]; char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading b

else {printf(\ } else

{printf(\}

void CloseF() /*Close File*/ {int i,k,n=0;

char fname[MAXNAME];

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(\ k=ExistD(dirname);

printf(\ for(i=0;i

{if (ifopen[k][i].ifopen==1) {printf(\ if((n%4==0)&&(n!=0)) printf(\ }

printf(\ if (n==0) wgetchar=1; if(n!=0)

{printf(\ gets(fname);

ltrim(rtrim(fname)); i=ExistF(fname); if(i>=0)

{if(ifopen[k][i].ifopen==1) {ifopen[k][i].ifopen=0; ifopen[k][i].openmode=4;

printf(\ wgetchar=1; }

else {printf(\ }

else {printf(\} }

void ReadF() /*Read File*/ {int i,k,n=0;

char fname[MAXNAME];

char str[255],str1[255],c;

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))),%ufd dir before read.\\n\ printf(\ printf(\ k=ExistD(dirname); for(i=0;i

if ((ifopen[k][i].openmode==0) ||(ifopen[k][i].openmode==2)) {printf(\if((n%4==0)&&(n!=0)) printf(\ }

printf(\ if (n==0) wgetchar=1; if(n!=0)

{printf(\ gets(fname);

ltrim(rtrim(fname)); i=ExistF(fname); if(i>=0)

{if(ifopen[k][i].ifopen==1)

{if((ifopen[k][i].openmode==0) ||(ifopen[k][i].openmode==2)) {itoa(ufd[k]->ufdfile[i].fpaddr,str,10); strcpy(str1,\ strcat(str1,str);

strcpy(str,\ strcat(str,str1); fp_file=fopen(str,\ fseek(fp_file,0,0);

printf(\ printf(\

while(fscanf(fp_file,\ if (c=='\\n') printf(\ else printf(\

printf(\ fclose(fp_file); wgetchar=1; } else

{printf(\

read.\\n\ }

else {printf(\read\\n\ }

else {printf(\} }

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,Exist-i,Not Exist-0*/ int ExistD(char *dirname); int WriteF1(); /*write file*/

if (strcmp(strupr(ltrim(rtrim(dirname))),\{printf(\Please convert to ufd dir before write.\\n\ k=ExistD(dirname);

printf(\openned files with writable mode*/ for(i=0;i

if ((ifopen[k][i].openmode==1) ||(ifopen[k][i].openmode==2)) {printf(\if((n%4==0)&&(n!=0)) printf(\ }

printf(\ if (n==0) wgetchar=1; if(n!=0)

{printf(\ 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,\ strcat(str1,str);

strcpy(str,\ strcat(str,str1);

if (ufd[k]->ufdfile[i].flength!=0)

{printf(\write):\ gets(a);

ltrim(rtrim(a));

if (fp_file!=NULL) fclose(fp_file); if (strcmp(strupr(a),\ {printf(\fp_file=fopen(str,%ufd[k]->ufdfile[i].flength=0;

ufd[k]->ufdfile[i].flength=WriteF1(); }

else if(strcmp(strupr(a),\ {printf(\fp_file=fopen(str,\

ufd[k]->ufdfile[i].flength=ufd[k]->ufdfile[i].flength+WriteF1(); } else

{printf(\fclose(fp_file); wgetchar=1; } }

else

{fp_file=fopen(str,\

ufd[k]->ufdfile[i].flength=WriteF1(); } } else

{printf(\writed.\\n\ } else

{printf(\write\\n\ } else

{printf(\} }

void QuitF() /*Quit FileSystem*/ {int i,j; char str[50];

void SetPANo(int RorW); /*Set physical address num,0-read,1-write*/ 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;jufdname); ltrim(rtrim(str)); fp_ufd=fopen(str,\ fclose(fp_ufd);

fp_ufd=fopen(str,\ for(i=0;i

fwrite(&ufd[j]->ufdfile[i],sizeof(OSFILE),1,fp_ufd); fclose(fp_ufd);} }

…… 此处隐藏:1586字,全部文档内容请下载后查看。喜欢就下载吧 ……
操作系统2014课程设计(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/447902.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)