unit SystemStrLCopy;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: SystemStrLCopy
// Routine: SysUtils.StrLCopy

// BeginCode
{
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.
}
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;
// EndCode
// EndExample: SystemStrLCopy
end.
