[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] question about printing variable in c++
On Fri, 21 Dec 2001, Joo-Han Song wrote:
> Hi users,
>
> I am doing my simulation about modified AODV routing mechanism. I tried to printout some values of existing variable in ~ns/ns-2.1b8a/aodv.cc like:
>
> void
> AODV::recvRequest(Packet *p)
> {
>
> Tcl& tcl = Tcl::instance();
> Node *thisnode = Node::get_node_by_address(index);
> MobileNode *node_;
> struct hdr_cmn *ch = HDR_CMN(p);
> struct hdr_ip *ih = HDR_IP(p);
> struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);
> rt_entry *rt;
> double x = 0.0, y = 0.0, z = 0.0;
> node_ -> getLoc(&x, &y, &z);
> tcl.evalf("time = %.9f, x = %.2f, y = %.2f, z = %.2f, this node = %d\n", CURRENT_TIME, x, y, z, index);
>
> .............
> .............
> .............
> }
You can directly call printf or fprintf instead of calling the
time-expensive tcl.evalf for printing values out either to stdout or a
file.
--Padma
>
> As you might see from above tcl script, I tried to print out the value of CURRENT_TIME, x, y, z and index whenever recvRequest function is called.
> But there is nothing happened during my simulation.
> How can I see this values or make this value to be stored in specific file?
> Could anybody help me?
> Thank you in advance.
>
> Joo-Han
>
>
--
------------------------------------------------
Be true to your work, your word, and your friend.
--Thoreau
Padmaparna Haldar