C++ コードを実行しようとすると、メモリ破損エラーが発生します。
このコードは、ベクトル内の名前のリストを json 形式に変換します。
void fetchName(vector<double>& Name,string& Nameoutput)
{
Names_t *nameip=new Names_t();
for (int k = 0; k < Name.size(); k++ )
{
std::ostringstream strs;
strs << Name[k]; //The error occuse here if I comment this line
and run it does not five an error
nameip->jsonText->append(strs.str());
nameip->jsonText->append(",");
}
Nameoutput= nameip->jsonText->data();
}
どうすればこれを解決できますか?