Erlang - file_size


Advertisements


This method is used to determine the size of the file. This method is part of the filelib library.

Syntax

file_size(filename)

Parameters

filename − This is the file name for which the size needs to be determined.

Return Value

A number which tells the size of the file.

For example

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

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

Output

Depending on the contents of the file, the size of the file will be displayed. If the file contained the text “Example”, the output would be 7.


erlang_file_input_output.htm

Advertisements
E-Books Store