Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang File Append mode

Tags:

erlang

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

like image 724
Abhimanyu Avatar asked Jul 01 '09 06:07

Abhimanyu


1 Answers

The file:write_file function expects the last argument to be a list of atoms iso a string so changing your implementation to file:write_file("/tmp/test1.txt","Abhimanyu", [append]). should resolve your issue. Further examples can be found at TrapExit.

like image 170
Bas Bossink Avatar answered Oct 03 '22 03:10

Bas Bossink