XXXX程序错误,,内存0x 010010101010不能为read
等等诸如此类的提示。
你想动态的申请一块内存只需要一个函数自动为你分配就好,你查查函数mem()的算法。
你的意思是否可以理解为len+string.
int
a
=
100
char
*str
=
"the
string
value"
char
*strNew
=
new
char
[len
+
sizeof(a)]
char
*strTmp
=
str
*((int*)strTmp)
=
a
strTmp
+=
sizeof(a)
memcpy(strTmp,
str,
len)
delete
[]
strNew