云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > os实验指导书

os实验指导书

  • 62 次阅读
  • 3 次下载
  • 2025/6/16 5:17:52

{char dname[MAXNAME];

char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/

int ExistD(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ printf(\ gets(dname);

ltrim(rtrim(dname));

if (ExistD(dname)>=0) strcpy(dirname,strupr(dname));

else if(strcmp(strupr(dname),\ else printf(\}

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

if (strcmp(strupr(dirname),strupr(username))!=0)

{printf(\ else {

printf(\ gets(fname);

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

{printf(\

wgetchar=1; } else

{printf(\3-Protect):\

gets(fmode);

ltrim(rtrim(fmode));

if((strcmp(fmode,\ {fpaddrno=FindPANo(); if (fpaddrno>=0) {i=ExistD(username);

rcmp(fmode,\

}

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,\ itoa(fpaddrno,str1,10); strcat(str,str1); fp_file=fopen(str,\ fclose(fp_file); fcount[i]++; while(flag)

{printf(\ gets(a);

ltrim(rtrim(a));

ufd[i]->ufdfile[fcount[i]-1].flength=0; if(strcmp(strupr(a),\

{fp_file=fopen(str,\

ufd[i]->ufdfile[fcount[i]-1].flength=WriteF1(); flag=0;

}

else if(strcmp(strupr(a),\ }

printf(\ } else

{printf(\ }

else {printf(\

}}

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(\ 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;

delete.\\n\

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(\}

搜索更多关于: os实验指导书 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

{char dname[MAXNAME]; char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ int ExistD(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ printf(\ gets(dname); ltrim(rtrim(dname)); if (ExistD(dname)>=0) strcpy(dirname,strupr(dname)); else if(strcmp(strupr(dname),\ else printf(\}

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com