I am still would like to know why fileopen does not work?
You found the quirk in the Pascal language that still catches me out. mse mentioned it a few posts back.
(CODE A) This code is _incorrect_:
FileRead(fsIn, ByteRead, Fsize)
(CODE B) This code is correct:
FileRead(fsIn, ByteRead[0], Fsize)
The problem is, they both compile. The other issue is, if you defined something like:
ByteRead: array[0..5000] of byte;
Then, both (CODE A) and (CODE B) will work.
So, it is possible to write old school Pascal, which will break when you update it to use dynamic arrays.
It has todo with low level Pascal functions which define untyped parameters: (FileRead is one of many)
Function FileRead (Handle : THandle; out Buffer; Count : longint) : Longint;
Note: The parameter Buffer has no type. I dont fully understand the internals, but, Ive learnt to see the warning signs.
Anytime I use a function which has a untyped parameter, It tells me to either take care, or use something else.