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

Re: [ns] argc & argv




say in your tcl script you have

$pingagent send

argc is the number of arguments on the line
(command line), i.e., # of arguments to your program execution,
argv is the array holding them

command "sees" that there are 2 arguments
and that 2nd arguments equals "send"

then executes the code below...

>Date: Fri, 3 Nov 2000 19:02:23 +0530 (IST)
>From: Pushpendra Singh <[email protected]>
>To: [email protected]
>MIME-Version: 1.0
>
>Hello all
>	I am new user to ns .... I want to ask few questions abt working
>of ns 
>In any agents file say ping.cc we have the command function like
>
> if (argc == 2) {
>    if (strcmp(argv[1], "send") == 0) {
>      // Create a new packet
>      Packet* pkt = allocpkt();
>      // Access the Ping header for the new packet:
>      hdr_ping* hdr = (hdr_ping*)pkt->access(off_ping_);
>      // Set the 'ret' field to 0, so the receiving node knows
>    --------------
>-------------
>My question is where from we get these argc and argv values......??
>
>Regards,
>
>
>===============================================================================
>"  World   is   like   a   mirror,   reflecting   what   u   do !
>   give   the   world   the   best   &   best   will   come   to  u!!"	 
>
>
>Pushpendra Singh
>C-35,Nilgiri House
>IIT Campus,New Delhi
>E-mail:	[email protected]
>	[email protected]
>	[email protected]
>Ph.   : 91-11-6521278
>
>             Visit me at:  www.cse.iitd.ernet.in/~csa99010
>                           
>===============================================================================

Tarik