title: How big is an integer?
body: <p>What is the correct way to work out how many bytes an int is? and how do I write an int to a file descriptor?</p>
  
  <p>Here is a mock code sample which might make clear what I am trying to achieve:</p>
  
  <pre><code>char *message = "test message";
  int length = strlen(message);
  int fd = open(file, O_CREAT|O_RDWR);
  write(fd, length??, ??); // &lt;--- what goes here
  write(fd, message, length);
  </code></pre>
  
  <p><em>I dont care about platform independence and byte order, just that it can compile on as many platforms as possible.</em></p>