المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Character Exception



C++ Programming
07-21-2010, 06:11 PM
Hi,

Im having a LPSTR variable.I want to copy a string to this variable. The application is getting crashed while copying this string.I want to catch this exception.I have used exception class,but its not capturing that one.Please suggest me to do this.Im using the following code.

LPSTR lpszstr;
try
{
wsprintf(lpszstr,"%s","sdfsdfsd fsdfsdfsdf");
}
catch (CException *why)
{
::MessageBox(NULL,"test123","test",MB_OK);
}

Thanks,