Dear All,
Could you guide me how to change sprintf to print and keep in file
instead.I try to chabge but it's not work.

OLSR::command(int argc, const char*const* argv) {
                        .....

else if (strcasecmp(argv[1], "print_rtable") == 0) {

if (logtarget_ != NULL) {

sprintf(logtarget_->pt_->buffer(), "P %f _%d_ Routing Table",

CURRENT_TIME,

OLSR::node_id(ra_addr()));

logtarget_->pt_->dump();

rtable_.print(logtarget_);

}

void

OLSR_rtable::print(Trace* out) {

sprintf(out->pt_->buffer(), "P\tdest\tnext\tiface\tdist");

out->pt_->dump();

for (rtable_t::iterator it = rt_.begin(); it != rt_.end(); it++) {

OLSR_rt_entry* entry = (*it).second;

sprintf(out->pt_->buffer(), "P\t%d\t%d\t%d\t%d",

OLSR::node_id(entry->dest_addr()),

OLSR::node_id(entry->next_addr()),

OLSR::node_id(entry->iface_addr()),

entry->dist());

out->pt_->dump();

}
}


Best Regards,
chalida

Reply via email to