// find new size
nNewArraySize = StrNewSizeForCharReplace(pszString, pszFindString, pszReplaceString);

// nNewArry size is 1063

// alllocate memory
pszTemp= (unsigned char*)malloc(nNewArraySize + 1);

// add 1063 character in to pszTEmp

// 1063
nLength = strlen(pszTEmp) // length is 1063
free(pszTemp);

// Heap memory exception

How can remove this exception

why are you calling malloc() is a c++ program? Change it to new and see if that fixes the error. If not, then the real problem is in parts of the program that you did not post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.