jednakże pliki które wyeksportuje nie wszystkie działają tzn.
pliki dźwiękowe dowarzają się pliki txt to widać tylko krzaczki a spr inny program wyświetla jako puste
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
string remove_path(string path);
int main(int argc, char *argv[])
{
if(argc > 1){
fpos_t position;
int ktore = 1;
char buffer;
FILE* pFile = fopen(argv[1],"rb");
fseek ( pFile , 8 , SEEK_SET );
int size_file;
fread(&size_file,sizeof(size_file),1,pFile);
fseek ( pFile , 12 , SEEK_CUR );
while (!feof(pFile)) {
if(ftell (pFile) >= size_file){
break;
}
fseek ( pFile , 32 , SEEK_CUR );
ktore++;
}
printf("W pliku jest %i skompresowanych plikow\n",--ktore);
printf("Rozpoczynam eksportacje\n");
fseek ( pFile , 16 , SEEK_SET);
int ktore2 = 1;
while (!feof(pFile)) {
string path;
int pos, size;
fread(&pos,sizeof(pos),1,pFile);
fread(&size,sizeof(size),1,pFile);
char tab[24];
fread(&tab,sizeof(tab),1,pFile);
for(int i = 0;i<24;i++){
if((int)tab[i]==0){
break;
}
path += tab[i];
}
path = remove_path(path);
printf("Eksportacja %i/%i | %s \n",ktore2++,ktore,path.c_str());
fgetpos (pFile, &position);
FILE* pFile2 = fopen(path.c_str(),"wb");
if(pFile2 != NULL){
fseek ( pFile , pos , SEEK_SET);
while(ftell (pFile) <= pos+size){
fread(&buffer,sizeof(buffer),1,pFile);
fwrite (&buffer , 1 , sizeof(buffer) , pFile2 );
}
fclose(pFile2);
fsetpos (pFile, &position);
}
if(ftell (pFile) >= size_file){
break;
}
}
fclose(pFile);
}
system("PAUSE");
return EXIT_SUCCESS;
}
string remove_path(string path){
string buffor;
int skad = 0;
for(int i = path.length();i>=0;i--){
if((int)path[i] == 47 || (int)path[i] == 92){
skad = i+1;
break;
}
}
for(int i = skad;i<path.length();i++){
buffor += path[i];
}
return buffor;
}download przykładowego pliku PAK
Level12 rar


Dodatki SourceMod



Temat jest zamknięty










