方案1:
char data[1024] ={0};
char temp_vl[11][255]={0};
string add_str="";
for (int i = 0; i<MAXITEMNUM; i++)
{
cout<<value[i]<<endl;
sprintf(temp_vl[i],"%f",value[i]);
add_str.append(temp_vl[i]);//+=temp_vl[i];
add_str.append(",");
}
sprintf(data,"%s",add_str.c_str());
&data
data长度:strlen(data)+1,