how to open a file descriptor

Glynn Clements glynn.clements@virgin.net
Sun, 2 Feb 2003 03:28:15 +0000


David Roundy wrote:

> Hello.  I'm in the process of interfacing with some C code (libcurl), and I
> thought that the easiest way to transfer the data in (which is a file
> transfered over the network) would be to open a pipe and write it into the
> pipe, and then to pass the pipe over to haskell where I could read it with
> the IO monad normally.

Note that GHC supports sockets directly, via the Network (high-level)
and Network.Socket (low-level) modules.

> Is there any nice way to open up a file descriptor? I was looking at the
> ghc internal code, which has an openFd function that would do what I want,
> but it doesn't seem to be exported.  :(  Any ideas?

GHC has an interface to the POSIX I/O API (i.e. descriptors) in
System.Posix.IO.

-- 
Glynn Clements <glynn.clements@virgin.net>