{"id":297,"date":"2009-04-06T13:31:00","date_gmt":"2009-04-06T05:31:00","guid":{"rendered":""},"modified":"2013-11-17T19:58:24","modified_gmt":"2013-11-17T11:58:24","slug":"%e5%af%b9%e6%af%94%e4%b8%a4%e4%b8%aa%e6%96%87%e4%bb%b6%e6%98%af%e5%90%a6%e7%9b%b8%e5%90%8c%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/297.html","title":{"rendered":"\u5bf9\u6bd4\u4e24\u4e2a\u6587\u4ef6\u662f\u5426\u76f8\u540c\u7684\u51fd\u6570"},"content":{"rendered":"<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nfunction CompFile(const f1,f2: string): Boolean;\r\nvar\r\nfs1,fs2: TFileStream;\r\nms: TMemoryStream;\r\ni,p: Integer;\r\nb1,b2: Byte;\r\nbegin\r\nResult := False;\r\nif not (FileExists(f1) and FileExists(f2)) then Exit;\r\nfs1 := TFileStream.Create(f1, fmOpenRead);\r\nfs2 := TFileStream.Create(f2, fmOpenRead);\r\nif fs1.Size &lt;&gt; fs2.Size then\r\nbegin\r\n    fs1.Free;\r\n    fs2.Free;\r\n    Exit;\r\nend;\r\n\r\nResult := True;\r\nRandomize;\r\nfor i := 0 to 9 do\r\nbegin\r\n    p := Random(fs1.Size);\r\n    fs1.Position := p;\r\n    fs2.Position := p;\r\n    fs1.ReadBuffer(b1,1);\r\n    fs2.ReadBuffer(b2,1);\r\n    if b1 &lt;&gt; b2 then\r\n    begin\r\n      Result := False;\r\n      Break;\r\n    end;\r\nend;\r\n\r\nfs1.Free;\r\nfs2.Free;\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function CompFile(const f1,f2: string): Boolean; var fs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":4783,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions\/4783"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}