The Windows API equivalent for fread
is ReadFile
and for fseek
is SetFilePointer
. If you merely replace those calls the performance difference will be slim, if any. In contrast to fseek
, SetFilePointer
supports files > 2GB. If you don't need that the call is simply:
SetFilePointer(myFile, iBytePos, NULL, FILE_BEGIN);
You can speed up disk I/O using the Windows API by exploiting its greater flexibility. If you have lots of seek-read-seek-read operations you might benefit from using ReadFileScatter
instead.
Another potential route for optimization would be to use Asynchronous I/O. A comparison can be found at Synchronous and Asynchronous I/O.