So After some meatballs and a can of coke, my brain is refreshed and I spotted the error.
My modifying the Read Method, was pointless as it is called after an Eof Call.
So I have placed a throw before the while loop in ReadBytes and that now once the end of file is reached another read will throw a TStreamReadException. The read of the stream that reaches the EOF will return correctly.
so here is the working function
most of solving this was getting my head around asserts, and rushing to get it done.
Could this be added to the official mods? I don't like having to mod BRLs functions.
Cheers.
My modifying the Read Method, was pointless as it is called after an Eof Call.
So I have placed a throw before the while loop in ReadBytes and that now once the end of file is reached another read will throw a TStreamReadException. The read of the stream that reaches the EOF will return correctly.
so here is the working function
Method ReadBytes( buf:Byte Ptr,count ) Local n = count 'MARK: new line If Eof() Then Throw New TStreamReadException While count>0 And Not Eof() Local n = Read( buf , count ) If Not n Throw New TStreamReadException count:-n buf:+n Wend Return n End Method
most of solving this was getting my head around asserts, and rushing to get it done.
Could this be added to the official mods? I don't like having to mod BRLs functions.
Cheers.