Erlang——複製



此方法用於複製現有檔案。

語法

copy(source,destination)

引數

  • − 需要複製的原始檔名稱。

  • 目標 − 檔案的目標路徑和名稱。

返回值

例如

-module(helloworld).
-export([start/0]). 

start() ->   
   file:copy("Newfile.txt","Duplicate.txt").

輸出

一個叫做 Duplicate.txt 的檔案將在與 Newfile.txt 相同位置產生,其內容與 Newfile.txt 相同。

erlang_file_input_output.htm
廣告
© . All rights reserved.