[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Printing from C++ through tcl



Hello,

I am trying to print some information messages from my new agent.

There are two ways to do this.

1) include the stdio.h library in my C++ code and use a usual printf
command, eg

#include <stdio.h>

printf("My number is: %d\n",number);

2) use the tcl evalf function, e.g.

Tcl& tcl = Tcl::instance();
tcl.evalf("puts stdout \"My number is: %d\n\"",number);

But the second command is much more complicated, as I have to include
the command_puts stdout_ and the _\"_ to protect the string. Is there an
easier way of printing through tcl (maybe through resultf), or do I just
have to use the good old printf?

Thanks

Nikos