Erlang File Append mode
erlang
Solution
On the "don't create it if it doesn't exist" additional question, you have to be more creative by using something like file:read_file_info :
case file:read_file_info(FileName) of
{ok, FileInfo} ->
file:write_file(FileName, "Abhimanyu", [append]);
{error, enoent} ->
% File doesn't exist
donothing
end.
The append mode (or write mode) will create the file if it doesn't exist...
Problem
I m trying to write some content in file using append mode in erlang but it giving error as bad argument. ``` Syntax used: file:write_file("/tmp/test1.txt","Abhimanyu","append"). error:{error,badarg} ``` thank you