Mailing list archive (omnetpp-l at omnetpp.org)


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

Re: [omnetpp] Question How to identify the number of the host...whichcommand to use in the code?



I haven't tested the code but I think that it must works

           char aux[50];
           strcpy (aux,this->fullPath().c_str());
           const char *leftbracket = strchr(aux,!=,'[');
           const char *rightbracket = strchr(aux,']');
           std::string nodenumber;
           nodenumber.assign(leftbracket +1, rightbracket -rightbracket -1);
            int number = atoi(nodenumber.c_str());



--------------------------------------------------
From: "Henrique Santos" <henrynavigator at xxx>
Sent: Tuesday, April 08, 2008 1:11 PM
To: "OMNeT++ Discussion List" <omnetpp-l at xxx>
Subject: [omnetpp] Question How to identify the number of the 
host...whichcommand to use in the code?

> Hello to all i have a simple question:
>
> I have a couple of nodes in Inet and each node is a different mobile host. 
> How do i identify using a command (code) which number refers to the host. 
> For example in C:\INET-20061020\Examples\Adhoc\Ieee80211 where i have 
> different mobile hosts which command should i use to identify the number 
> of the respective host...I think module->id() or similar is not what i 
> want since the nodes are equal in the modules they use, but in fact are 
> different instances/identities and have different numbers(i.e. mobile host 
> number=1, mobile host number=2, mobile host number=3,....)
>
> Help apreciated Thank you
>
> Greetings
> Henrique
> _______________________________________________
> OMNeT++ Mailing List
> options: http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
> archive: http://www.omnetpp.org/listarchive/index.php
> 
_______________________________________________
OMNeT++ Mailing List
options: http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
archive: http://www.omnetpp.org/listarchive/index.php

Home | Main Index | Thread Index