title: read() : Invalid arguments
body: <p>I'm trying to read a binary file with <code>read()</code> on a well functioning <code>open()</code>returned file descriptor but it just doesn't work returning <code>22</code> with <code>errno</code>.</p>
  
  <p>Here is the code :</p>
  
  <pre><code>int input = open(argv[1], O_RDONLY|O_DIRECT);
  char buffer_header[4];
  if(read(input,buffer_header,4) &gt; 0)
      image_width = bytesToInt(buffer_header);
  printf("%d\n",errno);
  </code></pre>
  
  <p>What's happening is that the condition on <code>read()</code> is not matched. Am I doing something wrong? The file descriptor returned is <code>3</code>.</p>