文件管理Word下载.docx
《文件管理Word下载.docx》由会员分享,可在线阅读,更多相关《文件管理Word下载.docx(26页珍藏版)》请在冰豆网上搜索。
{
hang=16;
lie=16;
intj,k;
//cout<
<
"
矩阵的行"
endl;
//cin>
>
hang;
矩阵的列"
lie;
srand(time(NULL));
for(j=0;
j<
j++)
{
juzhen[0][j]=1;
}
for(j=1;
for(k=0;
k<
k++)
juzhen[j][k]=(rand()%2);
cout<
当前没有任何目录和文件,系统为你自动进入C:
,如需帮助请选择H"
ml=(mulu*)malloc(sizeof(mulu));
zhizhen=(mulu*)malloc(sizeof(mulu));
zhizhen=ml;
strcpy(ml->
name,"
C"
);
ml->
awenjian=NULL;
top=NULL;
next=NULL;
amulu=NULL;
}
~wjgl()
intwjgl:
cd()
node1*s;
node1*r;
r=(node1*)malloc(sizeof(node1));
s=(node1*)malloc(sizeof(node1));
s=ml;
r=zhizhen;
charmlname[20];
cin>
mlname;
if(!
strcmp(mlname,"
.."
))
if(zhizhen->
top==NULL)
{
cout<
不存在该目录的根目录"
return0;
}
else
zhizhen=zhizhen->
top;
//showweizhi();
return0;
else
r=r->
amulu;
while(r!
=NULL)
if(!
strcmp(r->
name,mlname))
{
zhizhen=r;
//showweizhi();
return0;
}
else
if(r->
next==NULL)
break;
r=r->
next;
目录不存在"
return0;
mk()
structtm*newtime;
char*tmpbuf=newchar[120];
time_tlt;
time(&
lt);
newtime=localtime(&
strftime(tmpbuf,128,"
%c"
newtime);
//showweizhi();
node*s;
s=(node*)malloc(sizeof(node));
s=zhizhen->
awenjian;
node*s1;
s1=(node*)malloc(sizeof(node));
请输入文件的名称"
charfname[20];
fname;
请输入文件的大小"
intdaxiao;
daxiao;
strcpy(s1->
name,fname);
s1->
daxiao=daxiao;
if(s==NULL)
zhizhen->
awenjian=s1;
s1->
time=tmpbuf;
//cout<
文件创建成功"
//return0;
elseif(!
strcmp(s->
name,fname))
cout<
文件名字重复"
while(s->
next!
if(!
next->
s=s->
s->
next=s1;
inti,j,k;
k=0;
inti1=-1;
intj1=-1;
for(i=0;
i<
i++)
for(j=0;
if(juzhen[i][j]==0)
if(j1==-1)
{
s1->
begin=i*lie+j+1;
if(daxiao==1)
{
juzhen[i][j]=-1;
s1->
return0;
}
else
i1=i;
j1=j;
k++;
continue;
}
else
if(daxiao-k==1)
juzhen[i1][j1]=i*lie+j+1;
juzhen[i1][j1]=i*lie+j+1;
i1=i;
j1=j;
k++;
voidwjgl:
showweizhi()
cout.setf(3);
chardizhi[20][10];
inti=0;
intj;
s=r->
strcpy(dizhi[i],r->
name);
i++;
r->
name<
->
;
while(s!
strcpy(dizhi[i],s->
//cout<
s->
i++;
for(j=i;
j>
0;
j--)
dizhi[j-1];
if(i==j)
\\"
rd()
showweizhi();
r=zhizhen->
输入要删除的目录的名字"
charming[20];
ming;
if(r==NULL)
name,ming))
if(r->
amulu!
=NULL||r->
awenjian!
目录不空不能删除"
amulu=r->
删除成功"
while(r->
if(r->
cout<
r->
next=r->
//cout<
md()
node1*s;
s=(node1*)malloc(sizeof(node1));
s->
strcpy(s->
name,ming);
top=zhizhen;
amulu=s;
目录已经存在"
while(r->
r=r->
strcpy(s->
r->
next=s;
//cout<
创建成功"
del()
inti,j;
inttemp;
删除不成功"
i=(s->
begin-1)/lie;
j=(s->
begin-1)%lie;
while(juzhen[i][j]!
=-1)
temp=juzhen[i][j];
juzhen[i][j]=0;
i=(temp-1)/lie;
j=(temp-1)%lie;
juzhen[i][j]=0;
awenjian=s->
i=(s->
j=(s->
while(juzhen[i][j]!
temp=juzhen[i][j];
juzhen[i][j]=0;
i=(temp-1)/lie;
j=(temp-1)%lie;
s->
next=s->
//cout<
文件不存在不能删除"
tree()
charc=getchar();
if(c=='
'
)
jiansuo();
shuchu(zhizhen);
showweishitu()
//cout.width();
位"
示图为"
setiosflags(ios_base:
left)<
setw(4)<
juzhen[j][k];
shuchu(mulu*sc)
i=0;
j=0;
mulu*r1;
r1=(node1*)malloc(sizeof(node1));
r1=zhizhen;
mulu*r;
r=sc->
<
dir>
"
."
zhizhen=zhizhen->
if(zhizhen==NULL)
;
{cout<
.."
zhizhen=r1;
while(r!
time<
s=sc->
j++;
k=k+s->
大小"
daxiao<
当前共有目录"
个"
当前共有文件"
个总大小为:
intcount=0;
if(juzhen[j][k]==0)
count++;
剩余"
count<
jiansuo()
intk=0;
intj=0;
charname[20];
请输入名称"
name;
inttemp1=strlen(name);
if(panduan(name,r->
name)==1)
i++;
showweizhi();
if(panduan(name,s->
j++;
大小"
k=k+s->
目录"
文件"
个总大小为"
panduan(chara[],charb[])
intbiaoji=0;
strcmp(a,b))
return1;
inttemp=strlen(a);
inttemp1=strlen(b);
for(i=0,j=0;
temp&
&
temp1;
i++,j++)
if(a[i]=='
*'
if(i==temp-1)
return1;
biaoji=1;
j--;
continue;
if(biaoji==1)
while(a[i]!
=b[j])
j++;
if(i==temp||j==temp1-1)
?
'
if(j==temp1-1)
return1;
else
return0;
elseif(a[i]==b[j])
if(i==temp&
j==temp1)
/*if(temp>
temp1)
return1;
*/
#include<
iostream>
#include"
usingnamespacestd;
voidmenu()
H-----------------help"
S----------------查看位示图"
MD----------------在目录文件中创建子目录"
CD----------------根据当前目录切换到指定目录"
RD----------------搜索所要删除的目录是否为空目录,若是则删除"
MK----------------在当前目录中创建文件名称"
DEL---------------搜索所要删除的文件是否存在,若是则删除"
DIR---------------列出当前目录的所有目录项"
E-----------------退出程序"
intmain()
wjglawjgl;
//menu();
while
(1)
awjgl.showweizhi();
请选择操作"
charxuanxiang[20];
cin>
xuanxiang;
strcmp(xuanxiang,"
H"
)||!
h"
menu();
MD"
md"
awjgl.md()