Reading a binary file
- Posted by Brian Broker <bkb at CNW.COM> Aug 16, 2000
- 453 views
In the example for 'get_bytes', it shows how to read a binary file 100 bytes at a time and when then length of the returned sequence is less than 100, the end of the file has been reached: while 1 do chunk = get_bytes(fn, 100) -- read 100 bytes at a time whole_file &= chunk -- chunk might be empty, that's ok if length(chunk) < 100 then exit end if end while Is there an easier/faster way to read in a binary file to a sequence in one shot? Thanks, Brian