c++ - TCL C API Create and Register new Channel -
i use tcl 8.6(windows) , can't register , use new channels
std::ofstream file("1.txt"); tcl_channel kanal = tcl_createchannel(type, "mychann", file, tcl_writable); tcl_registerchannel(interp, kanal); file.close();
and type
tcl_channeltype* type = new tcl_channeltype(); type->closeproc = closeproc; type->inputproc = inputproc; type->outputproc = outputproc; type->typename = "my own chann"; type->version = tcl_channel_version_2;
functions simply, have std::cout
i run interpreter script
"chan puts mychan whatever"
and nothing happend, no errors interpreter, no output(console, file). dont know how bite this, first goal, create new chanel , use it, second replace tcl_stdout own channel(it can std::ofstream), when run interpreter with
"puts whatever"
that string go std::ofstream
probably did not flush output.
this can done with
flush mychan
you can configure channel flush @ end of line or whenever written it:
chan configure mychan -buffering line
(or none
). stdout default configured -buffering line
Comments
Post a Comment