动态数组的复制问题
一、
- Delphi(Pascal) code
var DataBuf, TmpBuf: array of Byte;begin TmpBuf:= Copy(DataBuf, 0, 72);end
二、
- Delphi(Pascal) code
var DataBuf: array of Byte; TmpBuf: array of Byte;begin TmpBuf:= Copy(DataBuf, 0, 72);end
如上两段代码所示,(代码没写全),假设我要从动态数组DataBuf拷贝72个字节到TmpBuf。
编译时第一段代码没问题,第二段会在Copy函数处提示“Incompatible types”错误。
这是为什么?
[解决办法]
Move(data1[0],data2[0],128)
[解决办法]