Erlang – file_size

Erlang file_size

In this guide, we will discuss Erlang file_size. 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.

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply