How to detect end of BinStream


#1

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


#2

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


#3

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.


#4

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


#5

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.