How to run tcl script accepts arg and returns result from c/c++?I tried this way and did'nt succeed:
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
#include "stdafx.h"
#include <stdlib.h>
int main(int argc, char* argv[])
{
Tcl_Interp *myinterp;
myinterp = Tcl_CreateInterp();
int status = Tcl_EvalFile(myinterp, "D:/TCL/test1.tcl 5");
printf("%s\n",myinterp->result);
const char* scriptFile = "D:\\TCL\\hello1.tcl";
status = Tcl_EvalFile(myinterp, scriptFile);
printf("%s\n",myinterp->result);
return 0;
}
test1.tcl :
package require Tk;
pack [label .l -text "Start test1"];
proc test1 a {set b [expr $a * 8];puts "b = $b";return $b};
-------------------------
hello1.tcl :
package require Tk
pack [label .l -text " Hi - Hello TclEvalFile world!"]
Help will be very appresiated
Raya
#include <stdio.h>
#include <tcl.h>
#include <tk.h>
#include "stdafx.h"
#include <stdlib.h>
int main(int argc, char* argv[])
{
Tcl_Interp *myinterp;
myinterp = Tcl_CreateInterp();
int status = Tcl_EvalFile(myinterp, "D:/TCL/test1.tcl 5");
printf("%s\n",myinterp->result);
const char* scriptFile = "D:\\TCL\\hello1.tcl";
status = Tcl_EvalFile(myinterp, scriptFile);
printf("%s\n",myinterp->result);
return 0;
}
test1.tcl :
package require Tk;
pack [label .l -text "Start test1"];
proc test1 a {set b [expr $a * 8];puts "b = $b";return $b};
-------------------------
hello1.tcl :
package require Tk
pack [label .l -text " Hi - Hello TclEvalFile world!"]
Help will be very appresiated
Raya