There is a method available to allow the reading of all the contents of a file at one time. This is done with the file_read method. The details of this command are as follows.
filename − This is name of the file which needs to be read.
The entire contents of the file.
-module(helloworld). -export([start/0]). start() -> Txt = file:read_file("Newfile.txt"), io:fwrite("~p~n",[Txt]).
When we run the above program, we will get the following result.