[erlang-questions] File is_open()

Ali Yakout ali.yakout@REDACTED
Tue Mar 4 08:23:46 CET 2008


Hi,

I'm doing some file processing and I want to prevent opening files while
it is already opened.
I tried to open the files in write mode but it always succeed (I can
open the file for writing many times)

1> file:open("file",[write]) <file:open(> .
{ok, <0,35,0>}
2> file:open("file",[write]) <file:open(> .
{ok, <0,37,0>}

I tried to rename the file after opening and it also succeeds, although
the documentation says "Renaming of open files is not allowed on most
platforms"

3> file:open("file",[read]) <file:open(> .
{ok, <0,35,0>}
4> file:rename("file","file2") <file:rename(> .
ok

Any clues ?


Thanks

Regards,
Ali Yakout

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080304/f348c914/attachment.htm>


More information about the erlang-questions mailing list