这一句为什么执行有错??
showmessage(strcat('aabb','ddcc'));
[解决办法]
可以这样用吗?
Use StrCat to concatenate Source to the end of Dest. StrCat does not perform any length checking. The destination buffer must have room for at least StrLen(Dest)+StrLen(Source)+1 characters.
目标必须要有源+1+目标的长度,何况你的目标是const的,不错才怪
正确的用法:
var
a:array[0..10] of char;
begin
strcopy(a,'aabb') ;
strcat(a,'ddcc');
showmessage(a);
[解决办法]
StrCat函数是把一个字符串加到目标字符串的后面,目标字符串的最后至少有一个空位。
var a : string;begin a :='aabb'; //设定值 SetLength(a, 4);//设置长度 增加4个空位 ShowMessage(StrCat(PChar(a),'ddcc'));//合并end;