jak skompresowac a potem zdekompresowac stringa przy pomocy zLib? (http://www.programmersheaven.com/d/click.aspx?ID=F24171&URL=http%3A%2F%2Fwww.dellapasqua.com%2Fdelphizlib%2Findex.asp%3fq=download)
0
0
Widzę, że chcesz, żeby forumowicze znów za ciebie pisali. SZUKAJ W GOOGLACH ZANIM ZAPYTASZ.
0
procedure PakujPlik(AForm:TForm;file_non_compres,file_compres:string);
var
ZLB1:TZLBArchive;
lista:TStrings;
begin
lista:=TStringList.Create;
ZLB1:=TZLBArchive.Create(AForm);
try
ZLB1.CreateArchive(file_compres);
lista.add(file_non_compres);
ZLB1.AddFiles(lista);
finally
lista.Free;
ZLB1.Free;
end;
end;
procedure RozpakujPlik(AForm:TForm;file_compres,file_non_compres:string);
var
ZLB1:TZLBArchive;
begin
ZLB1:=TZLBArchive.Create(AForm);
try
ZLB1.OpenArchive(file_compres);
ZLB1.ExtractFileByName(ExtractFileDir(file_non_compres),ExtractFileName(file_non_compres));
finally
ZLB1.Free;
end;
end;
0
Chodzi o Stringa !
albo chociaz ta metode hoffmana jak przerobic Files na stringi ? :
procedure TForm1.Button1Click(Sender: TObject);
var f:Tfreq; t:TTree; c:TCodes; i,j:integer; s:file; d:TBitWrite; cds:array[0..255,1..256] of byte;
bf:array[0..2047] of byte; fsize,csize:integer; fs:cardinal;
begin
Countchars('c:\a.txt',f);
Huff(f,t);
GetCodes(t,c);
for i:=0 to 255 do
begin
for j:=1 to length(c[i]) do if c[i,j]='1' then cds[i,j]:=1 else cds[i,j]:=0;
end;
assignfile(s,'c:\a.txt');
reset(s,1);
fsize:=filesize(s);
assignfile(d.f,'c:\b.txt');
rewrite(d.f,1);
blockwrite(d.f,t,sizeof(t));
fs:=filesize(s);
blockwrite(d.f,fs,sizeof(fs));
d.init;
repeat
blockread(s,bf,sizeof(bf),j);
for i:=0 to j-1 do
begin
d.write(cds[bf[i]],length(c[bf[i]]));
end;
until j<sizeof(bf);
d.flush;
closefile(d.f);
reset(d.f,1);
csize:=filesize(d.f);
closefile(d.f);
closefile(s);
writeln(csize,'/',fsize);
end;
0
Nikt nie będzie za Ciebie pisał programu, wydrukuj sobie opisy funkcji których nie znasz, siądz na spokojnie, poczytaj i POMYŚL!! [glowa] [glowa] [glowa] [glowa] [glowa]