Reading a binary file

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu