--
Erlang Programming Website:
http://www.erlangprogramming.org/
raw
The raw option allows faster access to a file, because no Erlang
process is needed to handle the file. However, a file opened in this
way has the following limitations:
The functions in the io module cannot be used, because they can only
talk to an Erlang process. Instead, use the read/2, read_line/1 and
write/2 functions.
Especially if read_line/1 is to be used on a raw file, it is
recommended to combine this option with the {read_ahead, Size} option
as line oriented I/O is inefficient without buffering.
**Only the Erlang process which opened the file can use it.**
A remote Erlang file server cannot be used; the computer on which the
Erlang node is running must have access to the file system (directly
or through NFS).
1> {ok, F} = file:open("bla.txt", [read, binary]).
{ok,<0.53.0>}
2> P1 = spawn(fun() -> receive _ -> io:format("~p~n", [file:read(F,
10)]) end end).
<0.55.0>
3> P2 = spawn(fun() -> receive _ -> io:format("~p~n", [file:read(F,
10)]) end end).
<0.57.0>
4> P2 ! P1 ! do.
{ok,<<"commit 94c">>}
{ok,<<"28693e1672">>}
do
On Wed, Oct 27, 2010 at 11:03 AM, Developer at Works
--
--Hynek (Pichi) Vychodil
Analyze your data in minutes. Share your insights instantly. Thrill
your boss. Be a data hero!
Try GoodData now for free: www.gooddata.com
On Wed, Oct 27, 2010 at 11:03 AM, Developer at Works
--
daw> I simplified the problem-statement. Now precisely the
daw> problem-statement is:-
Please see the OTP reference for the file:open/2 function's 'raw'
option:
http://www.snookles.com/erlang-docs/R13B04/lib/kernel-2.13.5/doc/html/file.\
html#open-2
The raw option allows faster access to a file, because no Erlang
process is needed to handle the file. However, a file opened in this
way has the following limitations:
[...]
* Only the Erlang process which opened the file can use it.
-Scott
--
You received this message because you are subscribed to the Google Groups "Chicago Erlang User Group" group.
To post to this group, send email to ce...@googlegroups.com.
To unsubscribe from this group, send email to ceug+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ceug?hl=en.