问题来源: http://www.cnblogs.com/del/archive/2008/11/08/1329543.html#2024604

{引用}
procedure TForm1.Button1Click(Sender: TObject);
var
  pp1,pp2: PPChar;
begin
  pp1^ := '万一的 Delphi 博客';
  pp2 := pp1;
  ShowMessage(pp2^);  //万一的 Delphi 博客

  pp1^ := 'Delphi 2011';
  ShowMessage(pp2^);  //Delphi 2011
end;

{复制}
procedure TForm1.Button2Click(Sender: TObject);
var
  pp1,pp2: PPChar;
  p: PChar;
begin
  pp1^ := '万一的 Delphi 博客';

  p := GetMemory(ByteLength(pp1^) + SizeOf(Char));
  StrCopy(p, pp1^);
  pp2 := @p;
  ShowMessage(pp2^); //万一的 Delphi 博客

  pp1^ := 'Delphi 2011';
  ShowMessage(pp2^); //万一的 Delphi 博客
  FreeMemory(p);
end;

posted on 2011-02-11 21:13  万一  阅读(3306)  评论(6编辑  收藏  举报