摘要:
procedure TForm1.Button3Click(Sender: TObject);var beforeMS,afterMS:TMemoryStream; {beforeMS 是要压缩的流; afterMS 是接收压缩后文件的流} cS:TCompressionStream; {定义压缩流} num:Integer; {原始文件大小}begin {第一步: 调入要压缩的文件, 并获取大小} beforeMS:=TMemoryStream.Create; beforeMS.LoadFromFile('F:\cc.doc'); num:=bef... 阅读全文
摘要:
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Memo1: TMemo; Button4: TButton; procedure FormCreate(Sender: TObject); proced... 阅读全文
摘要:
//TStringList 常用方法与属性:var List: TStringList; i: Integer;begin List := TStringList.Create; List.Add('Strings1'); {添加} List.Add('Strings2'); List.Exchange(0,1); {置换} List.Insert(0,'Strings3'); {插入} i := List.IndexOf('Strings1'); {第一次出现的位置} List.Sort; ... 阅读全文
摘要:
procedure TForm1.Button1Click(Sender: TObject);var FromF,ToF: file; NumRead,NumWritten: Integer; Buffer: array[1..2048] of Byte;begin AssignFile(FromF, 'c:\temp\test1.dat'); //假定有这个文件 Reset(FromF, 1); AssignFile(ToF, 'c:\temp\test2.dat'); Rewrite(ToF, 1); repeat BlockRead(FromF, Buff 阅读全文