我的程序在字符串賦值中崩潰。我不能忽視它的確切原因。多個線程執行相同的代碼。由於Linux C++中的SIGABRT導致的崩潰PowerPC
這是我的代碼。
char* cTemp = new char[5];
memset(cTemp,'\0', 5);
snprintf(cTemp , 5 , "%04x" , iParameter);
string sVar1 = cTemp;
delete[] cTemp;
if(sVar1 == "0")
sVar1 = "0000";
pSharedLib->setVar1(sVar1);
所設定的功能(在共享庫)
bool A::setVar1(CString& temp)
{
m_sVar1= temp;
return true;
}
碰撞BT示出了誤差作爲
#0 0x48194444 in raise() from /lib/libc.so.6
#0 0x48194444 in raise() from /lib/libc.so.6
No symbol table info available.
#1 0x48199694 in abort() from /lib/libc.so.6
No symbol table info available.
#2 0x481d4ecc in ??() from /lib/libc.so.6
No symbol table info available.
#3 0x481e14d4 in ??() from /lib/libc.so.6
No symbol table info available.
#4 0x481e32b0 in free() from /lib/libc.so.6
No symbol table info available.
#5 0x480df8b8 in operator delete(void*)() from /usr/lib/libstdc++.so.6
No symbol table info available.
#6 0x480b136c in std::string::_Rep::_M_destroy(std::allocator<char> const&)
() from /usr/lib/libstdc++.so.6
No symbol table info available.
#7 0x480b35f4 in std::string::assign(std::string const&)()
from /usr/lib/libstdc++.so.6
No symbol table info available.
'string'和'CString'似乎是不同的類型。 – Erik 2011-04-18 11:13:03
多數民衆贊成在一個錯別字對不起....都是字符串..我已經淡化了一些函數/ typedefs,使其更簡單! – Prashanth 2011-04-18 11:20:23