I have a program were I am trying to do some simple text logging to find an error that only manifests in release mode. I have added my logging code, and it is not flagged as an error anywhere except in the class's destructor:
CParameterMgr::~CParameterMgr ()
{
sprintf(logData, "Deleting m_pValueBuff (Destructor)");
TextLogger::WriteLog(logData);
delete [] m_pValueBuff;
}
I am actually getting "error C2065: 'sprintf' : undeclared identifier"
Can anyone explain why sprintf cannot be used in a destructor?
Thanks
No limitation on usage of sprintf in destructor exists. You just forgot include appropriate header file.
C-style way is
#include <stdio.h>
C++-style way is
#include <cstdio>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With