xcramps
xcramps

Reputation: 1213

Passing a file descriptor opened in C to a tcl interpreter for use

I have a C program in which I create a tcl interpreter. I then open a file in the C program and want to pass it onto the tcl interpreter so the tcl interpreter can do I/O on it.

And I realize I could just open the file in the tcl interpreter, but I get an open file descriptor some somewhere else, so that's not an option, unfortunately.

Any ideas or tricks, or did I miss something in the tcl C API?

Upvotes: 0

Views: 1031

Answers (2)

smcameron
smcameron

Reputation: 1327

Wouldn't have have to open the file before you create the tcl interpreter process, if it's going to have the file descriptor have meaning?

If you open after, and say in the C program you have file descriptor 9, and you then pass this 9 to the tcl interpreter process, that 9's not going to mean anything.

Upvotes: 0

msorc
msorc

Reputation: 917

man Tcl_MakeFileChannel

Read there about Tcl_MakeFileChannel and Tcl_RegisterChannel

Upvotes: 1

Related Questions