title: Copy sparse files
body: <p>I'm trying to understand Linux (UNIX) low-level interfaces and as an exercise want to write a code which will copy a file with holes into a new file (again with holes).</p>
  
  <p>So my question is, how to read from the first file not till the first hole, but till the very end of the file? 
  If I'm not mistaken, <code>read()</code> returns 0 when reaches the first hole(EOF).     </p>
  
  <p>I was thinking about seeking right byte by byte and trying to read this byte, but then I have to know the number of holes in advance. </p>