本文整理汇总了C++中FileList::IsFileExist方法的典型用法代码示例。如果您正苦于以下问题:C++ FileList::IsFileExist方法的具体用法?C++ FileList::IsFileExist怎么用?C++ FileList::IsFileExist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileList
的用法示例。
在下文中一共展示了FileList::IsFileExist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int agv,char *agc[])
{
char lstname[256],dataname[256];
if (agv==1) {
printf("Need Argument\n");
return -1;
}
if (agc[1][0]=='x') {
char filename[256];
int i;
strcpy(lstname,agc[2]);
strcpy(dataname,agc[2]);
strcat(lstname,".lst");
strcat(dataname,".wdf");
if (!file_exist(lstname)) {
printf("Can't open list file[.lst]\n");
return -1;
}
if (!file_exist(dataname)) {
printf("Can't open data file[.wdf]\n");
return -1;
}
_mkdir(agc[2]);
FileList list;
int n;
n=list.ReadListOnly(lstname);
std::vector<FILE_LST> old_list;
int old_number=read_lst(dataname,old_list);
FILE *df;
df=fopen(dataname,"rb");
for (i=0;i<n;i++) {
FILE *f;
int j;
static char buffer[1024];
strcpy(filename,agc[2]);
strcat(filename,"\\");
int n;
n=list.IsFileExist(i,old_list,old_number);
printf("%s [%x] ",list.GetName(i),list.GetID(i));
if (n<0) {
printf(" Can't find\n");
continue;
}
strcat(filename,list.GetName(i));
char *path=strchr(filename,'\\');
path=strchr(path+1,'\\');
if (path) {
path[0]=0;
_mkdir(filename);
path[0]='\\';
}
f=fopen(filename,"wb");
fseek(df,old_list[n].offset,SEEK_SET);
for (j=0;j<old_list[n].size-1024;j+=1024) {
fread(buffer,1,1024,df);
fwrite(buffer,1,1024,f);
}
j=old_list[n].size-j;
fread(buffer,1,j,df);
fwrite(buffer,1,j,f);
fclose(f);
printf(" Extracted\n");
}
fclose(df);
return 0;
}
strcpy(lstname,agc[1]);
strcpy(dataname,agc[1]);
strcat(lstname,".lst");
strcat(dataname,".wdf");
if (!file_exist(lstname)) {
printf("Can't open list file[.lst]\n");
return -1;
}
if (file_exist(dataname)) {
printf("Updating Data File...\n");
update_datafile(dataname,lstname);
}
else {
printf("Creating New Data File...\n");
create_new(dataname,lstname);
}
return 0;
}