Category: File IO
Syntax:
fileReadBytes:Int(fileHandle:Int, bytes:Byte[], count:Int)
Int
Reads count bytes from a file straight into a Byte array, in one call. Returns how many it read.
Reads up to count bytes from the file's current position into the array, starting at element 0, and moves the position on past them. Returns how many bytes it read: fewer than count at the end of the file, and 0 if the handle isn't valid. The array must hold at least count bytes.
Much quicker than fileReadByte in a loop for a block of binary data: a disc sector, an image, a whole file.
View detailed documentation online
Global sector:Byte[2352]
Local f:Int = fileReadFile("game.bin")
Local got:Int = fileReadBytes(f, sector, 2352)
Print "Read " & ToString(got) & " bytes"
fileCloseFile(f)
BambooBasic © 2026 Michael Denathorn