SystemStrLCopy (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses an edit control and a button on a form. When the button is clicked, the first X bytes of the edit control are copied into a buffer, where X is a predefined number.

Code

const MAX_BUFFER = 10;
procedure TForm1.Button1Click(Sender: TObject);
var
  Buffer: array [0..MAX_BUFFER] of char;
begin
  StrLCopy(Buffer, PChar(Edit1.Text), MAX_BUFFER);
  Application.MessageBox(Buffer, 'StrLCopy example', MB_OKCANCEL);
end;

Uses