資源簡介
非常適合初學者的,用C語言開發的文件多用戶二級文件系統,可以讀,寫,寫保護,讀保護等,有一些簡單的動畫界面
代碼片段和文件信息
#include?“stdio.h“
#include?“string.h“
#include?“conio.h“
#include?“stdlib.h“
#include?
#define?MAXNAME?25??????????????????/*the?largest?length?of?mfdnameufdnamefilename*/
#define?MAXCHILD?50?????????????????/*the?largest?child每個用戶名下最多有50個文件*/
#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:0-Read?Only;1-Write?Only;2-Read?and?Write;?3-Protect;*/
????char?fname[MAXNAME];???????????/*file?name*/
}?MainFile;
typedef?struct?????????????????????/*the?structure?of?UserDir定義用戶文件目錄*/
{
char?ufdname[MAXNAME];?????????/*用戶文件目錄?name*/
MainFile?ufdfile[MAXCHILD];????/*用戶文件目錄?own?file*/
}UserDir;
typedef?struct????????????????????/*the?structure?of?OSUFD‘LOGIN定義用戶結構體*/
{
char?ufdname[MAXNAME];????????/*ufd?name*/
????char?ufdpword[8];?????????????/*ufd?password*/
}?User;
typedef?struct?????/*file?open?mode定義操作方式*/
{
int?ifopen;?????/*ifopen:0-close1-open*/
????int?openmode;???/*0-read?only1-write?only2-read?and?write3-protect*/
}OPENMODE;
void?LoginSystem(); ???????????????/*LOGIN?FileSystem*/
void?DirFile(); ???????????????????/*Dir?FileSystem*/
void?Create();?????????????????????/*Create?File*/
void?Delete();?????????????????????/*Delete?File*/
void?ModifyFileMode();?????????????/*Modify?FileMode*/
void?OpenFile(); ???????????????/*Open?File*/
void?CloseFile();??????????????????/*Close?File*/
void?ReadFile(); ???????????????/*Read?File*/
void?WriteFile();??????????????????/*Write?File*/
void?QuitSystem(); ???????????????/*Quit?FileSystem*/
void?ChangeUser(); ???????????/*Change?Dir*/
void?SaveFile();???????????????????/*save?user?file*/
void?DeleteUser();?????????????????/*save?user*/
void?FirstUse();???????????????????/*The?fist?time?use?system*/
void?Clean();??????????????????????/*clean?the?screen*/
void?Loading();????????????????????/*loading?user?and?file*/
int??CreateUser(char*);????????????/*create?new?user*/
void?Help();
char?*RemoveTailBlank(char?*str);??/*remove?the?trailing?blanks.*/
char?*RemoveHeadBlank(char?*str);??/*remove?the?heading?blanks.*/
void?InputPW(char?*password);??????/*input?passworduse?‘*‘?replace*/
int?ExistUser(char?*dirname);??????/*Whether?DirName?ExistExist-iNot?Exist-0*/
int?WriteFile1();??????????????????/*write?file*/
int?ExistFile(char?*filename);?????/*Whether?FileName?ExistExist-iNot?Exist-0*/
void?SetPANo(int?RorW);????????????/*Set?physical?address?num*/
int?FindPANo();????????????????????/*find?out?physical?address?num*/
int?UserNum=0;?????????????????????/*the?count?of?mfd‘s?ufds用戶數*/
int?FileNum[MAXCHILD];?????????????/*the?count?of?ufd‘s?files子文件數*/
int?loginsuc=0;????????????????????/*whether?login?successfully登陸成功*/
char?username[MAXNAME];????????????/*record?login?user‘s?name?原始登錄用戶名*/
- 上一篇:VC++ 軌跡運動源碼
- 下一篇:C語言倉庫管理系統
評論
共有 條評論