C++ Best way to quickly read from larger file
<p>During runtime I frequently need to read small portions of larger file (300 mb).
Currently I always open up the file, read from it and then close it again like that:</p>

<pre><code>FILE *file =fopen(szFileName,"rb");
if (file)
{
    fseek( file,iFirstByteToRead, SEEK_SET);
    fread(nEncodedBytes,sizeof(unsigned char), iLenCompressedBytes, file);
    fclose(file);
}
</code></pre>

<p>But that is too slow because I do that so frequently. 
Also I am not sure if fread could be sped up.</p>

<p>What is the best practice for such a situation, please?</p>
