[erlang-questions] Problem in file:rawopen/2

Sumith Gamage <>
Sat Feb 23 13:13:08 CET 2008


Dear All,

I use following code segment to copy directory in Linux.

    io:fwrite("~p:~p:copy_file(~p, ~p, ~p): Called.~n", [?MODULE, ?LINE,
Src, Dest, Opts]),
    {ok, InFd} = file:rawopen(Src, {binary, read}),
    io:fwrite("~p:~p:copy_file: Opend read file (~p, ~p).~n", [?MODULE,
?LINE, Src, InFd]),
    {ok, OutFd} = file:rawopen(Dest, {binary, write}),
    io:fwrite("~p:~p:copy_file: Opend write file (~p, ~p).~n", [?MODULE,
?LINE, Dest, OutFd]),

It works fine.

I used the same code in Windows it fails with the same even with the same
Erlang version (I tried with 5.5.5 & 5.6 both).

Here is the output (with version 5.5.5):

target_system:199:copy_file("tmp/erts-5.6/bin/epmd", "tmp/bin/epmd",
[preserve])
: Called.

=ERROR REPORT==== 23-Feb-2008::17:39:37 ===
Error in process <0.2389.0> with exit value:
{{badmatch,{error,enoent}},[{target
_system,copy_file,3},{target_system,create,1},{erl_eval,do_apply,5},{shell,e
xprs
,6},{shell,eval_loop,3}]}

** exited: {{badmatch,{error,enoent}},
            [{target_system,copy_file,3},
             {target_system,create,1},
             {erl_eval,do_apply,5},
             {shell,exprs,6},
             {shell,eval_loop,3}]} **

Kindly suggest me a workaround for this.

Thanks in advance...!

Sumith





More information about the erlang-questions mailing list