Re: figuring out a filename from it's handle...
- From: claird@xxxxxxxxx (Cameron Laird)
- Date: Thu, 30 Aug 2007 23:58:26 +0000
In article <1188512938.126341.153480@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx> wrote:
On Aug 30, 11:53 pm, daneyu...@xxxxxxxxx wrote:
If I've lost track of a filename that a channel was opened for, is
there a way to get the filename from just the channel name?
In other words, after doing the following:
set file_handle [open $filename r]
can I then use $file_handle to determine $filename?
If you're at the design step, just keep the association at script
level.
If you want to debug a large and barely modifiable script, on Linux
you can do some I/O on the channel under strace, find the underlying
file descriptor, and then look for the same descriptor in /proc/[pid]/
fd. These are pseudo-symbolic links giving the path of the files (or
pipe or socket IDs).
-Alex
Alexandre correctly observes that, as with so much of life, the
answer is, "it depends".
My personal bet is that you're looking for "no", that is, no, Tcl
does NOT build in an introspection that maps $file_handle ->
$filename. With more information about your situation, though,
it's almost certain we can turn that "no" into "yes".
.
- References:
- figuring out a filename from it's handle...
- From: daneyuleb
- Re: figuring out a filename from it's handle...
- From: Alexandre Ferrieux
- figuring out a filename from it's handle...
- Prev by Date: Re: Help! mem leak in c extension.
- Next by Date: Re: Help! mem leak in c extension.
- Previous by thread: Re: figuring out a filename from it's handle...
- Next by thread: Re: figuring out a filename from it's handle...
- Index(es):
Relevant Pages
|