Hello,
On Fri, 2012-02-03 at 12:30 -0500, Mirko Vukovic wrote:
> Hello,
>
> when I print a stream associated with an open file, I can see the file
> name there.
>
> How can I query the stream to get the associated file name?
>
> (I did look in the manual, and looked under sb-sys, but found
> nothing.)
>
SBCL's file streams are instances of SB-SYS:FD-STREAM.
You can query a file stream for FD (file descriptor) and file name like
this:
(with-open-file (file "/home/dvk/1.xml")
(values (sb-sys:fd-stream-fd file)
(pathname file)))
=>
5
#P"/home/dvk/1.xml"
According to CLHS, (pathname stream) returns the filename of a stream
(the pathname that was used to open it). SB-SYS:FD-STREAM-FD is an
SBCL-specific function.
|