title: ReadFile() returning 1 with "lpNumberOfBytesRead" set to 0
body: <p>I am using the VC++ function </p>
  
  <pre><code>ReadFile(FileHandle,charBuf,noOfBytesToRead,&amp;noOfBytesRead,NULL);
  </code></pre>
  
  <p>inside a for loop; in each iteration of the foor loop the FileHandle moves forward in the file i.e in each iteration we are reading a particular unit of the file and copying that unit (bunch of data in file) of data in file to <code>char *</code> array.</p>
  
  <p>This amount of data to be read (from the file to <code>char *</code> array) in each iteration is determined by "noOfBytesToRead". </p>
  
  <p>For some no: of iterations the ReadFile() is working fine but I observe that for some "n"th iteration (while reading nTH bunch of data) the 4th argument (<em>noOfBytesRead</em>) in the above call is set to 0 even though ReadFile() returns 1.</p>
  
  <p>Return value of ReadFile() is 1 indicating success &amp; the 4th parameter "noOfBytesRead" is set to 0, instead of no: of bytes Read. This is contradictory! Why is this so? </p>
  
  <p>Can anyone kindly help me in this. ReadFile() being an Win API I can't even step into code to debug further. </p>