BufferAlloc

Allocates a block of memory and returns it within a Buffer object.

Buffer := BufferAlloc(ByteCount , FillByte)

Parameters

ByteCount

Type: Integer

The number of bytes to allocate. Corresponds to Buffer.Size.

FillByte

Type: Integer

Specify a number between 0 and 255 to set each byte in the buffer to that number.

This should generally be omitted in cases where the buffer will be written into without first being read, as it has a time-cost proportionate to the number of bytes. If omitted, the memory of the buffer is not initialized; the value of each byte is arbitrary.

Return Value

The return value is a new Buffer object.

Remarks

All bytes within the buffer are zero-initialized.

An exception is thrown if the memory could not be allocated, such as if ByteCount is unexpectedly large or the system is low on virtual memory.

Buffer object, DllCall, NumPut, NumGet, StrPut, StrGet, File.RawRead, File.RawWrite