title: C, write system call, writing int
body: <p>I found this source in Jon Erickson's book, <a href="https://rads.stackoverflow.com/amzn/click/com/1593271441" rel="nofollow noreferrer" rel="nofollow noreferrer">Hacking: The Art of Exploitation</a>,</p>
  
  <pre><code>userid = getuid(); // get the real user ID
  // Writing data
  if(write(fd, &amp;userid, 4) == -1)  // write user ID before note data
      fatal("in main() while writing userid to file");
  write(fd, "\n", 1); // terminate line
  </code></pre>
  
  <p>I tried to compile this code, and found that on the file I write, userid (which is what I write in the code above) is not right; they just wrote strange character (I think is not important to write it here). So the problem is I am trying to pass an <code>int</code> to a function which required <code>char *</code>, because of that the result on file I want to write is false.</p>
  
  <p>So this is a bug, right?</p>