[fpc-pascal] GZip - Stream decompress only in memory

José Mejuto joshyfun at gmail.com
Sun Sep 4 21:29:43 CEST 2016


El 04/09/2016 a las 19:17, Marcos Douglas escribió:

>   try
>     Buf.LoadFromFile('data.txt');
>     showmessage(inttostr(ExtractStream(Buf, Buf2))); //<< result is 0, ie, OK
>     Buf2.SaveToFile('result.txt');

> There is no error, but Buf2 is empty.

Hello,

I'm not sure but I think that code at least should look like:

   try
     Buf.LoadFromFile('data.txt');
--->>>>  Buf.Position:=0;
     showmessage(inttostr(ExtractStream(Buf, Buf2)));
     Buf2.SaveToFile('result.txt');

Because I think the stream position is just at the end after LoadFromFile.


-- 




More information about the fpc-pascal mailing list