Hi I'm developing a COM component in an ATL project. I want to use std::ostringstream for logging some trace by log4cxx. Unfortunately seems that ATL doesn't support std::ostringstream and derivatives. Does any of you have an idea how can I use streaming classes in an ATL project or any alternative way? Thanks.
+1
A:
actually I found my mistake. It was a missing header file.
#include "stdafx.h"
#include <sstream>
#include "util.h"
#include <comutil.h>
std::ostringstream pvarObject_t2string(VARIANT const *pvarObject)
{
std::ostringstream str;
str<<"test";
str<<"Licence id: "<< pvarObject[ 0 ].bstrVal;
return str;
}
tguclu
2010-10-08 06:31:09
Wow. What happens if there's a null BSTR there? What happens if the type of variant is not VT_BSTR?
sharptooth
2010-10-08 06:52:39
yep you are right but they are checked before hand, it's just a code snippet. thx
tguclu
2010-10-14 12:40:28