Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Sys_error("Bad file descriptor")
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: IKEDA Katsumi <ikeda@m...>
Subject: [Caml-list] Sys_error("Bad file descriptor")

I make my log class the following.

---------------- ----------------
(* *)
class log =
  val mutable out = stderr
  method log_open name =
      out <- open_out_gen [Open_append;Open_creat] 0o666 name;
  method log_close = close_out out
  method write mes =
      output_string out mes; flush out;
---------------- ----------------

I use on Debian GNU/Linux 3.0 :
    mylog#write("program start\n");

Then the following error occurred.

  Fatal error: exception Sys_error("Bad file descriptor")

On FreeBSD 4.5, same error occurred.
On Red Hat Linux 7.2, no error occurred.

I change 
      out <- open_out_gen [Open_append;Open_creat] 0o666 name;
      out <- open_out name;
then program works well.

When I write in my --
  Printf.printf "out = %d\n" (Obj.magic out); flush stdout;
same value is printed.

What is wrong?


IKEDA Katsumi  <>
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: