@SMcNeillI have learned that you are usually correct and yes I love a good argument as long as it is a constructive one.
So READFILE is inside some compiled C++ code. The thing is GET statement gets it's bytesToRead value from string length. GET should be like this
GET handle, bytesToRead, fileBuffer
where handle is a file handle
bytesToRead is the number of bytes to read from the file
fileBuffer is where the file bytes are stored.
Only one fileBuffer.
However you can not enter a bytesToRead value directly into GET. GET essentially second guesses what the coder would REALLY like. That leads to complications.
GET figures out bytesToRead from (example)
string1 = space$(bytesToRead)
GET #1,string1 etc
so string1 is a variable length string - not fixed.
The thing is MEM works with a single memory block (fixed length) but GET works with multiple (variable) memory blocks (strings). It does not work out too well.
If you want the fastest load times, just get the whole file at once and then parse it.
I thought about that and it does work but to me that is a band aid approach.
Trust me! if I had a READFILE API sub the BMP viewer would be a 1000 times faster.
About 50 hours has gone into the BMP viewer why stop there. We have a resident API wizard and so much absolute talent, what other forum has that - none.
The other thing is that a READFILE sub is almost the same as a WRITEFILE sub
Think of all the high speed file access QB64 can do with some practical API subs. Some might think it is UNBASIC. Well look at modern day OSes has anyone noticed that they do not resemble the OSes when BASIC was invented.