[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] global variables possible?
thanks for the suggestion. I have one further question
following your suggestion.
In an attempt I tried to online access the tracefile during
the simulation, so that I get the global information. But I encounter
a file sharing problem. What I did is:
In the dump() procedure of trace.cc, I added:
fp = fopen("test.out","a+");
fprintf(fp,"%s", wrk_);
fclose(fp);
In the timeout() of tcp.cc, I added:
// want to know what caused timeout
fp = fopen("test.out","r");
fscanf(fp,......);
fclose(fp);
But doing this gives me a core dump whenever the code of timeout()
is executed. If I use locking machanism, and put the procedure
to sleep, will this influence the event-driven process of NS-2?
Would be very appreciate for suggestions!
Zhenghua
On Tue, 17 Oct 2000, Haobo Yu wrote:
> In otcl, add it as either a class variable (not a object variable) or a
> global tcl variable (see a tcl book on how to do this). In c++, do it as a
> class static member. If you want it in both worlds, declare it as a c++
> static then declare a otcl class linkage method to access it; see
> bind() and method() in packet.cc for an example. For more example, see
> addr-params.cc.
>