vanilla_driver最高效的读文件行的方法
April 7th, 2010
原创文章,转载请注明: 转载自系统技术非业余研究
本文链接地址: vanilla_driver最高效的读文件行的方法
vanilla_driver是Erlang内置的驱动,用于高效读取文件句柄或者文件名,官方的文档没记载.
我来挖掘下:
root@ubuntu:~# cat >>hello.txt hello world CTRL+D
root@ubuntu:~# erl
Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.5 (abort with ^G)
1> erlang:open_port("hello.txt", [stream,line, in,eof]).
#Port<0.498>
2> flush().
Shell got {#Port<0.498>,{data,{eol,"hello"}}}
Shell got {#Port<0.498>,{data,{eol,"world"}}}
Shell got {#Port<0.498>,eof}
ok
3>
高效无毒!
Post Footer automatically generated by wp-posturl plugin for wordpress.
Categories: Erlang探索
美,独!