- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- Reading the arguments from Tcl file in a C++ file
Hi,
I want to know what are the values that are get by the c++ file (eg: aodv.cc) from the tcl file (i am using wireless scenario using AODV protocol).
In the constructor class of aodv.cc the TclClass is created and the values are passed from the tcl file which is running. I want to know/print the values taken by the file as arguments from the tcl file.
I have used the tcl.evalf() functions to print the values but no use… it wont print anything….
Plz guide me…..
Your question is not clear. If you read your question from another person’s point of view, you can certainly realize that.
1. If you want to print anything from a c++ file, then you can use just use “printf”
2. If you want to print anything from a tcl script, then you can use just use “puts”
3. If you want to pass arguments to a tcl script, then Tcl scripts have access to the following predefined variables. Just learn to use it inside the script.
$argc – number items of arguments passed to a script.
$argv – list of the arguments.
4. If you want to pass a value from c++ to tcl then you can use bind command in c++ file as follows.
bind (“myvar_”, &myvar_);
You can use the myvar inside your tcl script to pass a value to c++ code or access a c++ value from tcl script. (But it is not simple so Learn more about this to do this)
Anyhow, still, I don’t understand your question.