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.