typedef struct temp
{
string x;
int y;
}nnx,*pnnx;
pnnx p=new nnx[10];
sprintf((char*)p[0].x.c_str()," thread send msg: hello.\r\n");
{
string x;
int y;
}nnx,*pnnx;
pnnx p=new nnx[10];
sprintf((char*)p[0].x.c_str()," thread send msg: hello.\r\n");
delete[] p;
p=NULL;
//结构体x初始化时默认为空字符串,x.size()为0,在vs2008下使用sprintf可以编译通过,但其实是越界的,后面delete时会出错。