Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

How do I convert a little endian used in htons() or htonl() to 32-bit chars?

$
0
0

Hello,

I am trying to reverse engineer a class within the open source ntop project sub-project nDPI.

The class considers a packet payload and uses a macro to compare two bytes (a word) to a little endian returned by htons() and htonl().

I would like to take the input values to htons() and htonl() and convert them to their 32-bit chars value.

It appears that htons() takes a 16-bit number in host byte order as an argument, and htonl() take a 32-bit number in host byte order as an argument.

How do I convert a "16-bit number in host byte order" or a "32-bit number in host byte order" into a 32-bit char value?

I'm definitely getting some wires crossed in my brain.

Thanks,

Matt


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>