我有以下代码
然而,当我尝试以下方法时:
int redirect_test(ClientData pClientData, Tcl_Interp *pInterp, int argc, char *argv[])
{
std::string result_str = "This is the output from the method";
Tcl_SetObjResult(pInterp, Tcl_NewStringObj(result_str.c_str(), -1));
return true;
}
然而,当我尝试以下方法时:
% set m [ redirect_test]
This is the output from the method
% puts $m
can't read "m": no such variable
如何从TCL函数中返回值?