【发布时间】:2011-12-19 10:50:14
【问题描述】:
我在 Borland Delphi 工作,我在 Borland C++ Builder 中有几行代码。我想将这些行翻译成 Delphi 源代码。
unsigned char *buf=NULL;
buf=new unsigned char[SPS*2];
for (i=0; i<SPS*2; i++)
buf[i]=2;
... ....
answers=buf[2];
我想用这个 buf 分配一个 PCHar 值;
a:PCHar;
a:=buf.
【问题讨论】:
-
1)
unsigned char=Byte,而不是Char(责备 Ritchie),2)new可以转换为GetMem(<integral sizeof>)或声明大小为 3 的中间类型) for 循环很简单
标签: c++ delphi char translate pchar