How to print out variables in the terminal

63 views
Skip to first unread message

Jie Chen

unread,
Dec 13, 2019, 7:47:32 AM12/13/19
to ns-3-users
Hi All,

I have devised a routing scheme defined in classes and methods. I want to print out some variables in order to check the sanity of the coding. So I defined a member function B with the routing class A using std::cout<< to print out the variable.

And in the main function, I called the function using object instance a->B().

Somehow when I ran the program, the outputs on the terminal did not show the variable values...It did not print..

Can anyone help explain why the B member function has not been called or if it has been called, why it has not output the variable values as expected?

Thanks a million in advance,

Best,

Jie

Benmir Abdelkader

unread,
Dec 14, 2019, 4:18:06 PM12/14/19
to ns-3-...@googlegroups.com
You can use fprintf i use it in ns 2.35 :
fprintf(stdout, "message is %d %0.9f\n", i, f);

‫في الجمعة، 13 ديسمبر 2019 في 1:47 م تمت كتابة ما يلي بواسطة ‪Jie Chen‬‏ <‪cencen...@gmail.com‬‏>:‬
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/e5281204-f3ce-43f2-a2fe-026cae96cdab%40googlegroups.com.


--

                                                                                                                                       

M. Benmir Abdelkader.

Maitre-assistant A.

Département d'Informatique et des Technologies de l'Information.

Faculté des Nouvelles Technologies de l'Information et de la Communication.

Université Kasdi Merbah Ouargla).

Laboratoire ReLa(CS)2-Université d'Oum El Bouaghi.

Equipe: MoVéVaSiS.

ORCID :  https://orcid.org/0000-0003-2948-3969

SCOPUS : https://www.scopus.com/authid/detail.uri?authorId=56097028200

Scholar : https://scholar.google.com/citations?user=G-ehSVwAAAAJ&hl=en
Reply all
Reply to author
Forward
0 new messages