tags:

views:

20

answers:

1

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
Wow. What happens if there's a null BSTR there? What happens if the type of variant is not VT_BSTR?
sharptooth
yep you are right but they are checked before hand, it's just a code snippet. thx
tguclu