Hi,
I have a function in VS-6 which displays Helzo. (Project settings I changed in VS-6 are: In C++ tab the Warning level is set to "Level4" and Debug info as " Program Database")
void CVCTempDlg::OnOK()
{
char* pChar;
pChar = "Hello";
*(pChar+3) = 'z';
AfxMessageBox(pChar);
}
When I try to use the same function in Visual Studio.Net 2005 it compiles fine but throws an exception during run time.
void
CtempDlg::OnBnClickedOk(){ char* pChar;
pChar = "Hello";
*(pChar+3) = 'z';
AfxMessageBox(pChar);}
I tried the following : IsBadWritePtr, memncpy, functions to set the 3rd char to Z, but no use.
Thanks in advance.
Kama