#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<windows.h>
#include<io.h>
#include<iostream>
#include<string>
#include<stdlib.h>
#include<string.h>
#include<windows.h>
#include<io.h>
#include<iostream>
#include<string>
using namespace std;
int count=0;
int count=0;
typedef struct note{
char path[50];
struct note *next;
}note,*lnote;
char path[50];
struct note *next;
}note,*lnote;
typedef struct node {
char name[20];
unsigned int size;
char name[20];
unsigned int size;
struct node *next;
}node,*list;
list creat(void);
void add(list *head,char *tname,int tsize);
void bwrite(char *fn);
void file_in(char *path_r,char *path_w);
void unzip(char *path_file,char *path_out);
void lookthepack(char *path);
lnote tcreat(void);
void tadd(lnote *thead,char *path);
void zip(char *ar1,char *ar2);
void lookthepack(char *path){
int i,j;
node p;
file *fp;
if((fp=fopen(path,”rb”))==null){
printf(“can’t open %sn”,path);
exit(1);
}
fseek(fp,0l,seek_set);
rewind(fp);
fread(&j,sizeof(j),1,fp);
printf(“打包文件总数为: %dn”,j);
for(i=0;i<j;i++){
fread(&p,sizeof(p),1,fp);
printf(“%sn”,p.name);
}
}
void zip(char *ar1,char *ar2){
char check;
int l;
list head=creat();
lnote thead=tcreat();
long handle;
struct _finddata_t fileinfo;
l=strlen(ar1);
for(;l>0;l–){
if(ar1[l-1]==’\’){
check=ar1[l];
break;}
}
if(check!=’*’)
strcat(ar1,”\*.*”);
if((handle=_findfirst(ar1,&fileinfo))==-1){
/* 以下为路径不包括通配符情况*/
printf(“路径不存在!n”);
exit(0);
}
else{
do{
if (!(strcmp(fileinfo.name, “..”)&&strcmp(fileinfo.name,”.”))){
continue;
}
char path_a[40];
/* 以下旨在获取除去通配符后的文件路径 */
int str_leng,t;
strcpy(path_a,ar1);
str_leng=strlen(path_a);
for(t= str_leng+1;;t–)
{if(path_a[t-1]==’\’){
path_a[t]=’
}node,*list;
list creat(void);
void add(list *head,char *tname,int tsize);
void bwrite(char *fn);
void file_in(char *path_r,char *path_w);
void unzip(char *path_file,char *path_out);
void lookthepack(char *path);
lnote tcreat(void);
void tadd(lnote *thead,char *path);
void zip(char *ar1,char *ar2);
void lookthepack(char *path){
int i,j;
node p;
file *fp;
if((fp=fopen(path,”rb”))==null){
printf(“can’t open %sn”,path);
exit(1);
}
fseek(fp,0l,seek_set);
rewind(fp);
fread(&j,sizeof(j),1,fp);
printf(“打包文件总数为: %dn”,j);
for(i=0;i<j;i++){
fread(&p,sizeof(p),1,fp);
printf(“%sn”,p.name);
}
}
void zip(char *ar1,char *ar2){
char check;
int l;
list head=creat();
lnote thead=tcreat();
long handle;
struct _finddata_t fileinfo;
l=strlen(ar1);
for(;l>0;l–){
if(ar1[l-1]==’\’){
check=ar1[l];
break;}
}
if(check!=’*’)
strcat(ar1,”\*.*”);
if((handle=_findfirst(ar1,&fileinfo))==-1){
/* 以下为路径不包括通配符情况*/
printf(“路径不存在!n”);
exit(0);
}
else{
do{
if (!(strcmp(fileinfo.name, “..”)&&strcmp(fileinfo.name,”.”))){
continue;
}
char path_a[40];
/* 以下旨在获取除去通配符后的文件路径 */
int str_leng,t;
strcpy(path_a,ar1);
str_leng=strlen(path_a);
for(t= str_leng+1;;t–)
{if(path_a[t-1]==’\’){
path_a[t]=’