c++builder  解压缩  TZCompressionStream  TZDecompressionStream

#include <System.ZLib.hpp>

 

void __fastcall TForm33::Button1Click(TObject *Sender)
{
    /* Create the Input, Output and Compressed streams. */
    TFileStream *input = new TFileStream(Edit1->Text, fmOpenRead);
    TFileStream *output = new TFileStream(Edit2->Text, fmCreate);
    TZCompressionStream *zip = new TZCompressionStream(output, zcDefault, 8);

    /* Compress data. */
    zip->CopyFrom(input, input->Size);

    /* Free the streams. */
    zip->Free();
    input->Free();
    output->Free();
}

// ---------------------------------------------------------------------------
void __fastcall TForm33::Button2Click(TObject *Sender)
{
    /* Create the Input, Output, and Decompressed streams. */
    TFileStream *input = new TFileStream(Edit2->Text, fmOpenRead);
    TFileStream *output = new TFileStream(ChangeFileExt(Edit1->Text, ""), fmCreate);
    TZDecompressionStream *unzip = new TZDecompressionStream(input);

    /* Decompress data. */
    output->CopyFrom(unzip, 0);

    /* Free the streams. */
    unzip->Free();
    input->Free();
    output->Free();
}

 

相关文章:

  • 2021-10-18
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-09-12
  • 2022-12-23
相关资源
相似解决方案