線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1614
推到 Plurk!
推到 Facebook!

CopyFile 未定義

答題得分者是:P.D.
spfrk
一般會員


發表:16
回覆:43
積分:11
註冊:2013-10-01

發送簡訊給我
#1 引用回覆 回覆 發表時間:2014-06-01 17:25:07 IP:114.45.xxx.xxx 訂閱
錯誤
不知要如何宣告.

我google 了些資料, 都是在講 windows delphi, 卻未提及 FireMonkey
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#2 引用回覆 回覆 發表時間:2014-06-02 21:11:28 IP:118.169.xxx.xxx 未訂閱
應該又是定義被改到其他 unit中了, xe6改版很大(至少對我來說), 所以要花時間找一下copyfile到底放到那裡了?
spfrk
一般會員


發表:16
回覆:43
積分:11
註冊:2013-10-01

發送簡訊給我
#3 引用回覆 回覆 發表時間:2014-06-02 21:52:37 IP:114.45.xxx.xxx 訂閱
因為我只要複製純文字檔,因此自己寫了一段,提供給各位先進參考

// 檔案複製
function TForm1.jCopyFile(vsc:string;vtg:string):Boolean;
var
vscFile,vtgFile:TextFile;
text:string;

begin
try
deletefile(vtg);
AssignFile(vscFile, vsc);
AssignFile(vtgFile, vtg);
ReWrite(vtgFile);

Reset(vscFile);
while not Eof(vscFile) do
begin
ReadLn(vscFile, text);
WriteLn(vtgFile,text);
end;
CloseFile(vscFile);
CloseFile(vtgFile);
Result := True;
except
Result := False;
end;
end;


aftcast
站務副站長


發表:81
回覆:1485
積分:1763
註冊:2002-11-21

發送簡訊給我
#4 引用回覆 回覆 發表時間:2014-06-02 23:25:32 IP:66.249.xxx.xxx 訂閱
http://docwiki.embarcadero.com/Libraries/XE2/en/System.IOUtils.TFile.Copy
===================引 用 spfrk 文 章===================
因為我只要複製純文字檔,因此自己寫了一段,提供給各位先進參考

// 檔案複製
function TForm1.jCopyFile(vsc:string;vtg:string):Boolean;
var
vscFile,vtgFile:TextFile;
text:string;

begin
try
deletefile(vtg);
AssignFile(vscFile, vsc);
AssignFile(vtgFile, vtg);
ReWrite(vtgFile);

Reset(vscFile);
while not Eof(vscFile) do
begin
ReadLn(vscFile, text);
WriteLn(vtgFile,text);
end;
CloseFile(vscFile);
CloseFile(vtgFile);
Result := True;
except
Result := False;
end;
end;


------


蕭沖
--All ideas are worthless unless implemented--

C++ Builder Delphi Taiwan G+ 社群
http://bit.ly/cbtaiwan
系統時間:2024-04-19 7:39:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!