Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re : [Caml-list] file_desc
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matthieu Wipliez <mwipliez@y...>
Subject: Re : [Caml-list] file_desc
----- Message d'origine ----
> De : Robert Fischer <robert.fischer@smokejumperit.com>
> À : caml-list <caml-list@yquem.inria.fr>
> Envoyé le : Mardi, 1 Juillet 2008, 16h35mn 53s
> Objet : [Caml-list] file_desc
> 
> Is there a way to convert a file_descr to/from an int in OCaml?  The type is 
> abstract, and there
> doesn't seem to be an obvious answer.

It is defined in the Unix module as an int. Perhaps some Obj.magic can do the trick?

For Windows however things are more complicated, because a file_descr is a "struct filedescr" value. It is possible to obtain an int from this using the win_CRT_fd_of_filedescr function or the CRT_fd_val(v) macro, both defined in unixsupport.h.
I think you can either use Obj.field or write a C function (basically calling win_CRT_fd_of_filedescr) to access this information.

> 
> Alternatively, is there a way to get at an inherited file_descr from a process I 
> execv'd into?

However I don't know about that :D

> 
> ~~ Robert.

Matthieu

> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs



      _____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr