When try to do a memset it gives the following exception
“Unhandled exception at 0x1023af7d (PxSmartInterface.dll) in SendOutDllTestExe.exe: 0xC0000005: Access violation writing location 0x40e3a80e.”
My memset statement will look like this
memset(lpStatus, 0, csStatus.GetLength());
This is not a C++ exception, it’s an operating exception. Either you accessed memory that didn’t exist or you corrupted a data structure and crashed its destructor. (I’m assuming you’re trying to zero out a block before
deleteing the structure it contains.)In C++ you don’t typically call
memset.std::filldoes the same thing (and typically calls through tomemsetif possible), but with type safety.If you want to zero out blocks of memory before
freeing them, you need a debugging library. There’s no clean way to access an object’s memory after its destructor has been called and beforefreeis called. Debug malloc is probably a feature of your dev environment.Edit: you might be able to access pre-
freememory for objects, but not arrays, by overridingdelete. But that is NOT an activity for a beginner/intermediate.