Search code examples
omnet++inet

OMNeT++ inet::b to Int


I'm trying to make an application that gets the size of an Ethernet chunk and stores it in a vector of ints. To get the chunk length I'm using the function provided by inet: chunk->getChunkLength(). Is there a way to convert the type inet::b to int?


Solution

  • To obtain the size of a chunk in bits use this code:

    int bitSize = b(chunk->getChunkLength()).get();
    

    If you want to obtain the size in bytes use this way:

    int byteSize = B(chunk->getChunkLength()).get();