[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] BayTcp files created?
On Monday 11 June 2001 14:02, Michele Clark Weigle wrote:
> I've updated to ns-2.1b8 and now, everytime I run a simulation,
> ftpdly.tr and ftpfilesize.tr are created in my working directory.
> I tracked this down to BayTcp (ftps.cc and ftpc.cc), but I haven't
> figured out how to get around this yet. Any ideas?
While I didn't write the code, the two files look like they are used
for debugging purposes. A FILE* is created for each file (one in
ftpc.cc and one in ftps.cc) that is used in a commented-out fprintf
statement.
Since the FILE* is not used in either file currently, you can apply a
short term fix by changing the initialization of static member
variables fp_ in each file from
FILE* <classname>::fp_ = fopen(...);
to
FILE* <classname>::fp_ = NULL;
It isn't very elegant, and could be a problem if the fprintf
statments are ever uncommented. Slightly more elegant approach
follows
/* added at the top of ftps.cc and ftpc.cc */
#define DEBUGoff
/* replace static variable initialization line with following */
/* have to do this in both ftps.cc and ftpc.cc */
#ifdef DEBUG
FILE* <classname>::fp_ = fopen(...);
#else
FILE* <classname>::fp_ = NULL;
#endif
/* uncomment the fprintf statements, then bracket with */
/* again, in both ftpc.cc and ftps.cc */
#ifdef DEBUG
fprintf(...); /* this is the uncommented fprintf */
#endif
DEBUG might not be the best choice for this macro variable. If the
author/maintainer wants to chime in with a better name .... :)
Brian Lee Bowers | RADIANT Team
[email protected] | Los Alamos National Laboratory