Erlang - 檔案大小



此方法用於確定檔案的大小。此方法是filelib庫的一部分。

語法

file_size(filename)

引數

  • filename − 這是需要確定大小的檔名。

返回值

一個數字,表示檔案的大小。

例如

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

start() -> 
   io:fwrite("~w~n",[filelib:file_size("Renamed file.txt")]).

輸出

根據檔案的內容,將顯示檔案的大小。如果檔案包含文字“Example”,則輸出將為7。

erlang_file_input_output.htm
廣告
© . All rights reserved.