91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-14
  • 語言: 其他
  • 標簽: linux??文件系統??

資源簡介

基于Linux的模擬文件系統管理的設計與實現 在Linux環境中實現文件系統的功能

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
typedef?struct?file{
????char?name[10];
????struct?file?*next;
}File;
typedef?struct?content{
char?name[10];
File?*file;
int?f_num;
struct?content?*next;
}Content;
typedef?struct?user{
????char?name[10];
????char?psw[10];
????Content?*con;
????struct?user?*next;
}User;
char?cur_user[20];
User?*user;
int?user_num=0;
void?write(char?name[]){
????FILE?*p;
????char?ch;
????p=fopen(name“w“);
????ch=getchar();
????while(1){
????????fputc(chp);
????????ch=getchar();
????????if(ch==‘#‘)?break;
????}
????fclose(p);
}
void?read(char?name[]){
FILE?*p;
int?i=0;
p=fopen(name“r“);
while(!feof(p)){
i++;
printf(“%c“fgetc(p));
}
if(i==0)?printf(“The?File?Is?Empty!\n“);
fclose(p);
}
void?addNewUser(){
int?exist;
char?name[10];
char?psw[10];
User?*head*p;
Content?*con;
if(user_num==10){
printf(“Has?10?users!\n“);
return;
}
do{
printf(“Input?New?User?Name(0~10):\n“);
scanf(“%s“name);
exist=0;
head=user->next;
while(head!=NULL){
if(strcmp(head->namename)==0){
exist=1;
break;
}
head=head->next;
}
if(exist==1)?printf(“The?User?Have?Existed!\nPlease?Input?Again:“);
}while(exist==1);
printf(“Input?New?User?Password(0~10):\n“);
scanf(“%s“psw);
p=(User?*)malloc(sizeof(User));
strcpy(p->namename);
strcpy(p->pswpsw);
con=(Content?*)malloc(sizeof(Content));
con->next=NULL;
p->con=con;
p->next=NULL;
head=user;
while(head->next!=NULL)?head=head->next;
head->next=p;
user_num++;
printf(“Add?New?User?Success!\n“);
}
int?display_files(Content?*con){
int?i=0;
File?*file;
file=con->file;
file=file->next;
while(file!=NULL){
i++;
printf(“File?%d:?%s\n“ifile->name);
file=file->next;
}
printf(“??A?Total?Of?%d?Files\n“i);
return?i;
}
int?is_exist_file(File?*fchar?name[]){
int?exist=0;
File?*file=f->next;
while(file!=NULL){
if(strcmp(file->namename)==0){
exist=1;
break;
}?
file=file->next;
}
return?exist;
}
void?add_file(Content?*con){
int?exist;
char?f_name[10];
char?tail[]=“.txt“;
FILE?*q;
File?*file=con->file;
File?*new_f;
if(con->f_num==10){
printf(“Has?10?file!\n“);
return;
}
do{
exist=0;
printf(“Input?New?File?Name:“);
scanf(“%s“f_name);
strcat(f_nametail);
if(is_exist_file(con->filef_name))?exist=1;
if(exist==1)?printf(“The?File?Have?Existed!\n“);
}while(exist==1);
q=fopen(f_name“w“);
fclose(q);
while(file->next!=NULL)?file=file->next;
new_f=(File?*)malloc(sizeof(File));
strcpy(new_f->namef_name);
new_f->next=NULL;
file->next=new_f;
con->f_num++;
printf(“Add?File?%s?Success!\n“f_name);
}
void?read_file(Content?*con){
char?name[10];
char?tail[]=“.txt“;
int?find=0;
File?*file=con->file->next;
printf(“Input?The?FileName?You?Want?To?Display:“);
scanf(“%s“name);
strcat(nametail);
???? while(file!=

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????9740??2009-07-08?23:45??file3.c

-----------?---------??----------?-----??----

?????????????????9740????????????????????1


評論

共有 條評論