FillMemory()

Syntax

FillMemory(*Memory, Size [, Value [, Type]])
Description
Fills the memory area with the specified value by repeatedly writing that value.

Parameters

*Memory The address of the memory area to fill.
Size The size in bytes of the memory area to fill.
Value (optional) The value to write into the memory area. The default is the value 0.
Type (optional) The type for the value. This can be one of the following constants:
  #PB_Byte     : Fills the memory using a byte (1 byte) value (default).
  #PB_Ascii    : Fills the memory using a byte (1 byte) value.
  #PB_Word     : Fills the memory using a word (2 bytes) value.
  #PB_Unicode  : Fills the memory using a word (2 bytes) value.
  #PB_Character: Fills the memory using a character (2 bytes in unicode).
  #PB_Long     : Fills the memory using a long (4 bytes) value.
  #PB_Integer  : Fills the memory using an integer value (4 bytes in 32-bit executable, 8 bytes in 64-bit executable).

Return value

None.

Example

  *Buffer = AllocateMemory(500)

  FillMemory(*Buffer, 500) ; Fill 500 bytes of value 0 (clear the memory area)
  FillMemory(*Buffer, 500, $FF) ; Fill 500 bytes of value $FF
  FillMemory(*Buffer, 500, $BADF00D, #PB_Long) ; Fill 500 bytes of value $BADF00D

See Also

AllocateMemory(), MemorySize()

Supported OS

All

<- CopyMemoryString() - Memory Index - FreeMemory() ->