Skip to content

ReadBytes

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions

Blitz3DBlitzPlusBlitzBasic

ReadBytes

ReadBytes:Int32 bank:Int32, file:Int32, offset:Int32, count:Int32
Parameter Mode Type Default Description
bank In Int32 required The bank to fill.
file In Int32 required A file opened for reading.
offset In Int32 required Where in the bank to put the first byte.
count In Int32 required How many bytes to read.

Returns: The number of bytes that were read.

Description

Reads bytes from an open file into a bank. It reads up to count bytes, and fewer when the file ends first.

Examples

source = CreateBank(4)
For i = 0 To 3
	PokeByte source, i, 65 + i
Next
file = WriteFile("banks_example.tmp")
WriteBytes source, file, 0, 4
CloseFile file
target = CreateBank(4)
file = ReadFile("banks_example.tmp")
Print ReadBytes(target, file, 0, 4)
CloseFile file
DeleteFile "banks_example.tmp"
Print Chr$(PeekByte(target, 2))
4
C

Related Commands

PokeInt, PokeShort, ResizeBank, WriteBytes

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally