Readbytes - Stream.bmx
BlitzMax Forums/BlitzMax Module Tweaks/Readbytes - Stream.bmx
| ||
Currently The Readbytes function in Stream.bmx (BRL.Streams) does not throw an exception when eof is reached, instead it just reads nothing from the stream. here is a fix for this. could this be added to the next version of blitzmax? 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 Cheers. |