> Erlang中文手册 > write_file/3 向文件写入数据

file:write_file/3

向文件写入数据

用法:

write_file(Filename, Bytes, Modes) -> ok | {error, Reason}

跟 file:write_file/2 一样,向文件 Filename 写入数据 Bytes。参数 Modes 则是一些指定设置。

Data = "{person, 'kalle', 25}.",
file:write_file("/app/test.txt", list_to_binary(Data), [binary]).