Calls readBin and then checks that the
returned vector has the expected length. If the file ends prematurely,
readBin silently returns fewer elements — this wrapper turns that
into an explicit error.
read_safe_bin(con, what, n, size, endian, ...)the vector of data read from the connection.
a connection object.
character string or type, passed to readBin.
integer, the number of elements to read.
integer, the number of bytes per element.
character string, "big" or "little".
additional arguments passed to readBin.