Erlang 文件 list_dir 方法 - Erlang教程

由网友 大卫 发布 阅读 7

Erlang 文件 list_dir 方法 - Erlang教程

Erlang 文件

此方法用于列出特定目录的内容。

语法

list_dir(directory)

参数

  • directory −需要列出其内容的目录。

返回值

包含目录中文件名的项目列表。

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

start() -> 
   io:fwrite("~p~n",[file:list_dir(".")]).

根据当前工作目录的内容,文件列表将相应显示。示例输出显示在以下程序中-

{ok,["helloworld.erl",".cg_conf","Newfile.txt","helloworld.beam"]}

Erlang 文件

Erlang 元组 list_to_tuple 方法 Erlang 元组 is_tuple 方法