SystemFillChar (Delphi)
Description
This example fills a char array with characters and then assigns the array to a text edit.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
S: array[0..79] of AnsiChar;
begin
{ Set to all Xs }
FillChar(S, SizeOf(S), Ord('X'));
Edit1.Text := S;
end;
Note: System.FillChar should be used with great care because untyped parameters can be the source of memory corruption.To avoid this problem, use SizeOf to find the number of bytes appropriate to fill for the data type of the first parameter.
Uses
- System.FillChar ( fr | de | ja )
- System.SizeOf ( fr | de | ja )