在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
需要引入system.ZLib包 procedure TFormMain1.Button25Click(Sender: TObject); //压缩 var LInput, LOutput: TFileStream; LZip: TZCompressionStream; begin inherited; LInput := TFileStream.Create(Edit2.Text, fmOpenRead); //需要压缩的文件 LOutput := TFileStream.Create(Edit3.Text + '.zip', fmCreate); //压缩完成的文件 LZip := TZCompressionStream.Create(LOutput); LZip.CopyFrom(LInput, LInput.Size); LZip.Free; LInput.Free; LOutput.Free; end; procedure TFormMain1.Button26Click(Sender: TObject); //解压 var LInput, LOutput: TFileStream; LUnZip: TZDecompressionStream; begin { Create the Input, Output, and Decompressed streams. } LInput := TFileStream.Create(Edit2.Text, fmOpenRead); //解压的文件 LOutput := TFileStream.Create(ChangeFileExt(Edit3.Text, '.txt'), fmCreate); //解压后的文件 LUnZip := TZDecompressionStream.Create(LInput); { Decompress data. } LOutput.CopyFrom(LUnZip, 0); { Free the streams. } LUnZip.Free; LInput.Free; LOutput.Free;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论