Converting from void * to use htonl
<p>I have a void * value in a structure and I need to send it through a socket to a server. I know I need to use</p>

<pre><code>int value = htonl(kv-&gt;value);
</code></pre>

<p>but the compiler is throwing errors</p>

<pre><code>passing argument 1 of ‘htonl’ makes integer from pointer without a cast [-Werror]
</code></pre>

<p>I also tried casting the void * to an int, did not work and I used </p>

<pre><code>htonl(*kv-&gt;value);
</code></pre>

<p>but that also threw errors. How do I get the void * to the right data type?</p>

<p>Side note: The structure is not editable as I am writing a framework.</p>

<pre><code>struct kvpair {
    void *value;
};
</code></pre>