I'd like to add information in a crash dump file, in case my application crashes.
Therefore I've created a __try
-__except
clause:
__try
{
Do_Something();
}
__except (ShowCrashdumpInformation(_T(__FUNCTION__));
Instead of just __FUNCTION__
, I'd like to add more information, but how can I do that?
The simpliest way is to use a CString
, but this is blocked because of compiler error C2712
(Cannot use __try in functions that require object unwinding).
So, I'd like to use LPCTSTR
strings (which are widely used in my application).
As a result it should look like (CString
alternative):
CString temp; temp.Format(_T("Do_Something, int=[%d], float=[%f], string=[%s]), iParam, fParam, strParam);
Do anybody have an idea?
Thanks
By far the easiest solution is to simply sidestep the problem. Just forward the exact arguments, not converted, to a (template) function which does the actual writing to file. Since the __catch
is not in the template function itself, but one level up the stack, you're safe.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments