- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 有关PChar.StrCopy的实验
procedure TForm1.Btnx_1Click(Sender: TObject);
var
StrxA:string;
PStrA:PChar;
begin
StrxA:='330226198501017036';
Application.MessageBox(PChar(StrxA),'');
GetMem(PStrA,100);
StrCopy(PStrA,PChar(StrxA));
Application.MessageBox(PStrA,'');
end;
procedure TForm1.Btnx_2Click(Sender: TObject);
const
P1: PChar = 'CodeGear';
P2: PChar = 'Delphi';
var
S: array[0..15] of Char;
begin
StrCopy(S, P1);
StrCat(S, ' ');
StrCat(S, P2);
ShowMessage(StrPas(S)); {CodeGear Delphi}
ShowMessage(S); {CodeGear Delphi}
end;