Wednesday, October 13, 2004

wcstok,strtok memory corruption

CString mystring("ob_jw_ay");

CString anotherstring ;

anotherstring =mystring;//memory corruption!!!

TCHAR* string = (TCHAR*)(LPCTSTR)mystring;
TCHAR seps[] = "_";
TCHAR* token;


token = strtok( string, seps );

while( token != NULL )
token = strtok( NULL, seps );

//Now both strings will be changed.Because both CString::m_pchData are pointing to the same memory and strok/wcstok changes it. If you want 'anotherstring' to remain unchanged do
anotherstring +=mystring;

Install/Upgrade NVIDI Driver in Ubuntu for CUDA SDK

Most linux distribution comes with the Nouveau https://nouveau.freedesktop.org/wiki/ display driver configured. If you need to use NVIDIA...