title: Serialize Strings, ints and floats to character arrays for networking WITHOUT LIBRARIES
body: <p>I want to transmit data over the network, but I don't want to use any foreign libraries (Standard C/C++ is ok).</p>
  
  <p>for example:</p>
  
  <pre><code>unsigned int x = 123;
  char y[3] = {'h', 'i', '\0'};
  float z = 1.23f;
  </code></pre>
  
  <p>I want this in an</p>
  
  <pre><code>char xyz[11];
  </code></pre>
  
  <p>array.</p>
  
  <p>Note:
  To transmit it over network, I need Network Byte order for the unsigned int (htonl function), then I need to somehow serialize the float to be in IEEE 754 form (theres many functions on the internet), and I know it.</p>
  
  <p>How do I get them into the the xyz-Array, nicely lined up end to end, so I can use this as a buffer for my socket + send() function? Obviously I have reverse functions (ntohl, and a reverse IEEE 754) to get them out but I need a technique there too, preferably the same...</p>
  
  <p>It would be something like this:</p>
  
  <pre>
  xyz in binary: 
  00000000 0000000 00000000 01111011 | 01101000 | 01101001 | 00000000 | 00111111 10011101 01110000 10100100
  - big endian repr. of u. int 123 - | - 'h'  - | - 'i'  - | - '\0' - | -   IEEE 754 repr of float 1.23   -
  </pre>
  
  <p>How can I accomplish this without external libraries and minimal use of standard library functions? This isn't so much for my program as for me to learn from.</p>