How to pass array argument through CommandLine Class?? Is it possible?

774 views
Skip to first unread message

Vaison

unread,
May 1, 2015, 7:30:38 PM5/1/15
to ns-3-...@googlegroups.com
Hi there,

I'm guessing about if there is any way to pass to the command line an array, I was trying in some ways but I got different kind of errors... Any help?
"Easy" example about what I want to get:

char const *ipaddrss[2]={"7.0.0.0", "8.0.0.0""};

  // Command line arguments
  CommandLine cmd;
  cmd.AddValue("
ipaddrss", "Number of IPs", ??????????);
 
  cmd.Parse(argc, argv);

What I should write where the bold(??????) is?

Regards,

~V

Tommaso Pecorella

unread,
May 2, 2015, 3:03:11 AM5/2/15
to ns-3-...@googlegroups.com
Hi,

no, the array-passing is not supported by command line.
The best thing is to pass a file name and write the array there.

Cheers,

T.

pdbarnes

unread,
May 2, 2015, 10:52:19 AM5/2/15
to ns-3-...@googlegroups.com
Or use a custom argument handler to save the results from multiple occurrences of the same argument.

See
https://www.nsnam.org/doxygen/classns3_1_1_command_line.html#a20ff2bd99fd51ef5438345a862a8a092

Usage would be like
"--arg=v1 --arg=v2 ..."
P
Reply all
Reply to author
Forward
0 new messages