English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
There is a way to read all the content of a file at once. This is done through the file_read method. The details of the command are as follows.
file_read(filename)
filename −This is the name of the file to be read.
All content 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.
{ok,<<"Example1\nExample2\nExample3">>}