replace malloc by new
C / C++ / MFC
2
Posts
1
Posters
0
Views
1
Watching
-
I have following code
int nSize = 100;
unsigned char* pBuffer;
// pBuffer = (unsigned char*)malloc(nSize);
// replaced by
pBuffer = new unsigned char(nSize);and I tried to clean it by
// free(pBuffer);
// replaced by
delete[] pBuffer;but seems not working ... I have done wrong ?
-
I have following code
int nSize = 100;
unsigned char* pBuffer;
// pBuffer = (unsigned char*)malloc(nSize);
// replaced by
pBuffer = new unsigned char(nSize);and I tried to clean it by
// free(pBuffer);
// replaced by
delete[] pBuffer;but seems not working ... I have done wrong ?