Dear all, I 'm tring to get value form .cc in my file , AgentCPU.h and AgentCPU.cc there is a integer called "npkts_" and a fuction "recv" for receive Packets when I finally finished a packet , I will increase the "npkts_" 1 In further , in my tcl script I want to access the "npkts_" my code is like this set cpu [new Agent\AgentCPU]puts [format "%d" "$cpu set npkts_"] However , ther value is not correct it is same to the value when I construct my AgentCPU like this AgentCPU::AgentCPU(): Agent(PT_TASK){...npkts_=199;...} the value will be 199, and in the "recv" function , I use "printf" to check if there is any problem ...npkts_++;printf("npkts is %d\n",npkts);...
and the value here is correct,every time I receive Packet will increase the "npkts" Is there any code wrong?? On the other hand, I use another way to debug In my "recv" function ...npkts_++;Tcl& tcl = Tcl:;instance();tcl.evalf("puts \" npkts is %d""",npkts_);.. In this way the message will be 1, and stop to print Can sombody give me a hand? How to get the correct value from .cc file? Any suggestion will be very thankful!!