How to detect end of BinStream


I have BinStream and would like to know when the end of it is reached, unfortunately eof is not worcking for BinStream.


You can use fseek with #seek_end together with ftell to get the length beforehands.


OK thanks, was also thinking about such solution, but thought there could be a simple one. Was thinking about something like fileSize function, which should return the size.


at the end of stream when you read any type it returns undefined . so loop reading is as “read while defined”


OK thanks, in the documentation there is nothing said about undefined value is returned when end of stream reached. Also there is realy a getFileSize, or something like that, funktion which returns the size of a file and since it seams fileStreams are the only streams in max it could be a solution. Like already mentioned many times, I am really new to maxscript, so sorry if tallking nonsence.