//在windows與UNIX中一不一樣我不知道但這這樣處理應該沒問題.
procedure TForm1.Button1Click(Sender: TObject);
var
S : String;
sf, df : TextFile;
begin
if FileExists('c:/sf.txt') then
begin
AssignFile(sf, 'c:/sf.txt')
AssignFile(df, 'c:/df.txt');
Reset(sf)
Rewrite(df);
while not eof(sf) do
begin
Readln(sf, S);
if Trim(S) <> '' then if not eof(sf) then Writeln(df, S) else Write(df, S);
end;
CloseFile(sf)
CloseFile(df);
end;
end;