io:setopts/2
设置指定输出端的配置选项
用法:
setopts(IoDevice, Opts) -> ok | {error, Reason}
设置指定输出端 IoDevice 的配置选项 Opts,下面是设置 test.txt 文件的 IO 配置选项。
{ok, IoDevice} = file:open("test.txt", [read]), io:setopts(IoDevice, [{encoding, unicode}]), io:getopts(IoDevice).