Sign in Join
FPDoc Onlineexperiment

FillByte procedure

In unit System

Fill memory region with 8-bit pattern.

Declaration

pascal
procedure FillByte(var x; count: SizeInt; value: Byte)

Description

FillByte fills the memory starting at X with Count bytes with value equal to Value. This is useful for quickly zeroing out a memory location. When the size of the memory location to be filled out is a multiple of 2 bytes, it is better to use Fillword, and if it is a multiple of 4 bytes it is better to use FillDWord, these routines are optimized for their respective sizes.

Errors

No checking on the size of X is done.

See also

Example: ex103

pascal
Program Example103;

{ Program to demonstrate the FillByte function. }

Var S : String[10];
    I : Byte;

begin
  For i:=10 downto 0 do
    begin
    { Fill S with i bytes }
    FillByte (S,SizeOf(S),32);
    { Set Length }
    SetLength(S,I);
    Writeln (s,'*');
    end;
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.