Assessing files through file descriptors

Gert Veldhuijzen van Zanten veldhvz@ipo.tue.nl
Thu, 22 Apr 1999 13:17:13 +0200


Hello,

I am involved in a rather large project in which we build a spoken
dialogue system. My responsibility is in writing the dialogue
management module, and, of course, I do that in Clean under Solaris.
For the communication with the other modules, we have been using
sockets, and I have written some small C routines to handle them.
In the new version of our system, we have changed the communication
framework between the modules, and consequently I am rewriting the
C routines. Now it occurred to me that things would be a lot easier
if I could the Clean *File type for the communication.
What I would need is a function

	fdopen :: Int -> (Bool,!*File)

that takes a file descriptor number, and returns the corresponding 
file (which should already be open) and the boolean signals if all 
went ok (be False if it were not already open.

If that is not possible we could perhaps use something like

	fdopen :: Int Int !*Files -> (Bool,!*File,*Files)

this function would be similar to fopen, except that the first argument
is a file descriptor number, rather than a file name.
Possibly it would be even nicer if we

Is this possible, and if yes, can anyone tell me how to do this?

Thanks in advance

-- 
Gert Veldhuijzen van Zanten      P.O. Box 513, NL-5600 MB  Eindhoven
 ____________________________    +31 40 2475260, fax: +31 40 2431930
| IPO, Center for Research   |                    veldhvz@ipo.tue.nl
|_on User-System Interaction_|  http://www.tue.nl/ipo/people/veldhvz