Hi,
Pls help me.
uses zstream....
const
cZIP_BUFFER_SIZE=1024;
var
mCsomag: TStrings;
mMSin,mMSout: TMemoryStream;
mZipstream: TCompressionStream;
Buf : PByte;
I,Count,NewCount : Integer;
begin
mCsomag:= TStringlist.Create;
mMSin := TMemoryStream.Create;
mMSout:= TMemoryStream.Create;
try
mCsomag.Append('abcdefghijklmnopqsrt');
mCsomag.SaveToStream(mMSin);
Buf:=GetMem(cZIP_BUFFER_SIZE);
Try
mZipstream := TCompressionStream.Create(clDefault, mMSout, true);
try
Repeat
Count:=mMSin.Read(Buf^,cZIP_BUFFER_SIZE);
NewCount:=Count;
While (NewCount>0) do
NewCount:=NewCount-mZipstream.Write(Buf^,NewCount);
Until (Count=0);
mMSout.SaveToFile(Application.Location+'out.txt'); // WRONG: 0 byte size !!!!!
finally
mZipstream.Free;
end;
Finally
FreeMem(Buf);
end;
finally
mMSin.Free;
mMSout.Free;
mCsomag.Free;
end;
This code working on wince, but out.txt size: 0 byte ! Why ?
I use lazarus v0.9.28.2.