char user[32];//存放当前登陆的用户名
typedef char ALFA[12];
ALFA KWORD[keynum];
//-------------------------------------------------------------------------------
-----------------
struct UFD{//用户文件管理模块
char filename[32]; //文件名
int safecode; //文件保护码
long length; //文件长度
}*curfile = NULL;
//-------------------------------------------------------------------------------
-----------------
struct MFD{//用户登陆信息管理模块
char username[32]; //用户名
bool filepoint; //用户目录下的文件指针,false 表示目录为空,true 为该用户目录中
有文件
}*curuser = NULL,*elseuser=NULL;
typedef UFD UFD;
typedef MFD MFD;
void main();
//-------------------------------------------------------------------------------
-----------------
void KeyWord()//初始化命令关键字
{
strcpy(KWORD[ 1],"bye"); strcpy(KWORD[ 2],"chmod");
strcpy(KWORD[ 3],"close"); strcpy(KWORD[ 4],"create");
strcpy(KWORD[ 5],"delete"); strcpy(KWORD[ 6],"list");
strcpy(KWORD[ 7],"open"); strcpy(KWORD[ 8],"read");
strcpy(KWORD[ 9],"write");
}
//-------------------------------------------------------------------------------
-----------------
int LoginDisplay() //登陆选项操作函数
{
int SELETE_1 = 0;
do
{
cout<<" *****请选择操作*****\n1、用户登陆 2、用户注册 0、退出"<<endl;
cin>>SELETE_1;
}while(SELETE_1<0 || SELETE_1>2);
system("cls");
return SELETE_1;
}
//-------------------------------------------------------------------------------
-----------------
bool Login(int SELETE)//用户登陆,注册函数
{
FILE *fp,*fp1,*fp2;
char name[12];
switch(SELETE)
{
case 1://用户登陆
if((fp = fopen("LOGIN.exe","rb")) == NULL)//打开用户注册目录管理文件
{
cout<<"\n 错误:不能打开登陆文件。"<<endl;
getch();system("cls");
return false;