不是FlushFileBuffer而是FlushFileBuffers;<br>还有中间一处fx也改成了fs<br>下面是我改好的程序,已经实现了将文件内容清空的功能,但是还是能用EasyRecovery恢复出文件名来。<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Edit1: TEdit;<br> procedure Button1Click(Sender: TObject);<br> procedure WipeFile(FileName: string);<br><br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> wipefile(edit1.Text);<br>end;<br><br>procedure TForm1.WipeFile(FileName: string);<br>var<br> max,n: LongInt;<br> i: integer;<br> fs: TFileStream;<br> buffer: array[0..4095] of char;<br>begin<br> for i:=Low(buffer) to High(buffer) do buffer:=#0;<br> fs:=TFileStream.Create(FileName,fmOpenReadWrite or fmShareExclusive);<br> try<br> n:=4096; <br> max:=fs.Size;<br> fs.Position:=0;<br> while max>0 do<br> begin<br> if max<n then n:=max;<br> fs.Write(buffer,n);<br> max:=max-n;<br> end;<br> FlushFileBuffers(fs.Handle);<br> finally<br> fs.Free;<br> end;<br> Deletefile(FileName);<br>end;<br><br>end.