by MirekCz » Jan 11, 2002 @ 2:27pm
memory mapped files aren't any good as they need to be in memory in the first place, what you need is:<br>1.keep your stuff together, best would be to keep it in one file if possible<br>2.read as much data as possible with one fread/whatever function. On a PC my test show that on a quite fast hd(7200rpm udma66 ibm) increasing the reading block size by 4 times (so like 64kb instead 16kb) increases the time needed for this operation only by 2. So a huge gain. Also if you're reading from "random" positions in files it's better to read from start to end then to jump all over the file (sort the positions you need to access first and then access them)<br><br>This helps you about harddisk access, if you use a flash memory card or so the transfer speed should be much larger and therefore it shouldn't be a problem to load the amount of data you need in well under a second. (if interested in future chat, specify how long it can take for the program to load data and what kind of data you read)<br><br>and about how I do it, I use something like this:<br>FILE *tgafile;<br>if (!(tgafile = _tfopen(fullname, _T("rb"))))<br>{<br>//handle error here<br>}<br>//our great fread<br>fread(&bpp,1,1,tgafile);<br>...<br>//close the file<br>fclose(tgafile);<br><br>don't know if it's the best method but I guess it's one of the fastest
With best regards,
Mirek Czerwinski