(working on OS X, using Lisp to call Tcl/Tk via the C API)
I do have the problem of adding a file descriptor I've got for a file
to the interpreter's channel list.
I want to be able to do
(in Tcl, fd = file descriptor)
fileevent fd readable [list my-function fd]
I tried to do the following:
(in C)
Tcl_RegisterChannel( interp, Tcl_MakeFileChannel( fd, TCL_READABLE ));
Still, when using the fileevent statement as shown above I get an
error saying
can not find channel "17"
(17 being the file descriptor I tried to register)
Anyone? Thx!!!
Frank
You should probably use Tcl_GetChannelName() on the result of
Tcl_MakeFileChannel() to get the name of the channel, as fileevent needs
this for its operation.
Michael
I don't know the C api, but "17" doesn't look like a valid channel name
to me. For instance, when I do an open via tcl I'll get back something
that looks like "file15".
Perhaps you need to convert your raw file descriptor into a tcl channel
name somehow.
--
Bryan Oakley
http://www.tclscripting.com
Thanks, yes, that was the problem with this piece of code.
But now I am working on the fact that Tcl_RegisterChannel segfaults
...
Any special experience here ?
Thx!
Frank