fileWriteBytes

Category: File IO

Syntax:

fileWriteBytes:Int(fileHandle:Int, bytes:Byte[], count:Int)


Parameters

Returns

Int



Summary

Writes count bytes from a Byte array to a file, in one call. Returns how many it wrote.

Writes the first count bytes of the array at the file's current position and moves the position on past them. Returns how many bytes were written, or 0 if the handle isn't valid.

Much quicker than fileWriteByte in a loop for a block of binary data.

View detailed documentation online



Example
Global data:Byte[256]

Local i:Int
For i = 0 To 255
    data[i] = i
Next
Local f:Int = fileWriteFile("bytes.dat")
fileWriteBytes(f, data, 256)
fileCloseFile(f)

BambooBasic © 2026 Michael Denathorn