VC str.FormatエラーBuffer too small
CString output ;
int size = m_NicInfo.size();
output.Format(_T(" %d \r
"),size);
//VE_NicINFO_IT it = this->m_NicInfo.begin();
//for(; it != m_NicInfo.end(); ++it){
// CString tmp;
// tmp.Format(_T(" GUID:%s\r
"),it->NicGUID);
// output += tmp;
// tmp.Format(_T(" :%s\r
"),it->NicDesc);
// output += tmp;
// tmp.Format(_T(" :%s\r
"),it->NicName);
// output += tmp;
// tmp.Format(_T(" INDEX:%s\r
"),it->NicClassIndex);
// output += tmp;
//}
for(int pos = 0; pos < size ; pos++){
CString tmp;
tmp.Format(_T(" GUID:%s\r
"),m_NicInfo.at(pos).NicGUID);
output += tmp;
tmp.Format(_T(" :%s\r
"),m_NicInfo.at(pos).NicDesc);
output += tmp;
tmp.Format(_T(" :%s\r
"),m_NicInfo.at(pos).NicName);
output += tmp;
tmp.Format(_T(" INDEX:%s\r
"),m_NicInfo.at(pos).NicClassIndex);
output += tmp;
}
writeLog(output);
str.FormatエラーBuffer too small
The call will fail if the string object itself is offered as a parameter to Format. For example, the following code will cause unpredictable results:
CAtlString str = _T("Some Data");
str.Format(_T("%s%d"), str, 123);
// Attention: str is also used in the parameter list.