erlang Line = "This line appended to file!\n",
{ok, IODevice} = file:open("test.txt", [append]), file:write(IODevice, Line), file:close(IODevice).
-module(appendline).
-export([start/0]).
start() ->
Line = "This line appended to file!\n",
{ok, IODevice} = file:open("test.txt", [append]), file:write(IODevice, Line), file:close(IODevice).
% These work identically, writing strings:
% io:put_chars(IODevice, Line)
% io:format(IODevice, "~s", [Line])
% io:fwrite(IODevice, "~s", [Line])
%
% This may be used to write atoms or literal lists of codes:
% io:write(IODevice, {list_to_atom(Line)}),