move(), copymemory()

move()

var
  buf1,buf2: array[0..9] of AnsiChar;
begin
  buf1 := '0123456789';
  buf2 := 'abcdefghij';

  Move(buf2[2], buf1[4], 5);

  ShowMessage(buf1); {0123cdefg9}
  ShowMessage(buf2); {abcdefghij}
end;

copymemory()
var
  buf1,buf2: array[0..9] of AnsiChar;
begin
  buf1 := '0123456789';
  buf2 := 'abcdefghij';

  CopyMemory(@buf2[2], @buf1[4], 5);

  ShowMessage(buf1); {0123456789}
  ShowMessage(buf2); {ab45678hij}
end;

posted @ 2008-11-17 10:20  delphi中间件  阅读(209)  评论(0编辑  收藏  举报