netutil.to-net32

function

Library: Network utilities (OMNETUTIL)
Import : omnetutl.xmd

Returns: a number encoded as a 32-bit binary value, with the bytes in network order


Declaration
export string function 
   to-net32 value integer c

Argument definitions

c
is an integer value


Purpose

Use netutil.to-net32 to translate an integer value into a sequence of bytes/octets that is the integer value's long network number encoding.

Example

This program creates a file containing the numbers from 0 to 1,000,000 (counting by 1,000s). It stores the numbers in network-ordered binary format, to create a smaller, platform-independent file.

  import "omnetutil.xmd" prefixed by netutil.
  
  process
     using output as file "net32.dat" with binary-mode
        repeat for integer i from 0 to 1000000 by 1000
           output netutil.to-net32 i
        again
     close s

This file can be read on any platform, with the same results.