title: C : Create a function to diplay number just with "write" function
body: <p>How can i write a basic function, just with "write' function contained in <code>#include&lt;unistd.h&gt;</code>, in order to display a number?</p>
  
  <p>example :</p>
  
  <p>ft_putnbr.c</p>
  
  <pre><code>int ft_putnbr(int nbr)
  {
      write(1, &amp;nbr, sizeof(int));
      return (0);
  }
  
  int ft_putchar(char c)
  {
      write(1, &amp;c, 1);
      return (0);
  }
  </code></pre>
  
  <p>main.c</p>
  
  <pre><code>int     ft_putnbr(int nbr);
  int     ft_putchar(char c);
  
  int     main(void)
  {
      ft_putnbr(6);
      ft_putchar('\n');
      ft_putchar('a');
      return (0);
  }
  </code></pre>
  
  <p>The ft_putchar works fine, but i would like to do the same with a number, with my "ft_putnbr" function.</p>
  
  <p>There is no error when i'm compiling or executing the soft, but a blank is display instead of my number.</p>