如何在 Erlang 文件中指定行的末尾写一个单词,比如说
第 1 行:“他是约翰”
write_word("poem.txt",1," doe.").
第 1 行:“他是 john doe。”
这就是我能做到的:
write_word(Filename, LineNumber, Word) ->
{ok, Data} = file:open(FileName, [read, write]),
% write the word at end of line with the specified line number