Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run tcl script accepts arg and returns result from c

Status
Not open for further replies.

RayWsz

Programmer
Jun 30, 2010
1
0
0
IL
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top