function StrLCopy(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar;
功能 返回将指针字符串Source指定长度MaxLen复制到指针字符串Dest中;
uses SysUtils;
const MAX_BUFFER = 10;
procedure TForm1.Button1Click(Sender TObject);
var
Buffer: array [0..MAX_BUFFER] of char; //这里数组必须要从0下标开始,不然会报错.
begin
StrLCopy(Buffer, PChar(Edit1.Text), MAX_BUFFER);
Application.MessageBox(Buffer, 'StrLCopy example', [smbOK], smsInformation, smbOK, smbCancel);
end;