From: Delaregue
Subject: system:fd-stream-fd
Date: 
Message-ID: <6b4aa54a.0303071857.66c51306@posting.google.com>
Hello,

Is there an equivalent to cmucl's system:fd-stream-fd in lispworks?

Thanks.

From: Nils Goesche
Subject: Re: system:fd-stream-fd
Date: 
Message-ID: <87fzpy2d2w.fsf@darkstar.cartan>
·········@netscape.net (Delaregue) writes:

> Is there an equivalent to cmucl's system:fd-stream-fd in lispworks?

If you mean you want a way to obtain the underlying Unix file
descriptor from a stream, here is how you find out such things:

First, open a file:

CL-USER 7 > (defparameter *stream* (open "/etc/passwd"))
*STREAM*

CL-USER 8 > *stream*
#<STREAM::LATIN-1-FILE-STREAM /etc/passwd>

Now, choose from the menu Values->Inspect.  You'll see a slot
STREAM::FILE-HANDLE bound to a small integer which is a likely candidate.
Now, choose Object->Class from the menu.  Click on
STREAM::FILE-HANDLE.  Below you see an entry

 Readers: STREAM::OS-FILE-HANDLE-STREAM-FILE-HANDLE

Try it out:

CL-USER 9 > (stream::os-file-handle-stream-file-handle *stream*)
5

CL-USER 10 > (close *stream*)
T

If you do (apropos "FILE-HANDLE") then, you'll also find that
there is a function IO:FILE-STREAM-FILE-HANDLE which is exported
from the IO package, so it is probably better to use this
instead.  If you are dealing with a socket stream, there is also
COMM:SOCKET-STREAM-SOCKET.

Regards,
-- 
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0
From: Delaregue
Subject: Re: system:fd-stream-fd
Date: 
Message-ID: <6b4aa54a.0303090420.7d077d74@posting.google.com>
Very useful. Thanks.