Sounds like you need to make a wrapper . Try something like this:
char* CallSomeFunc()
{
ostrstream ostr;
cout.rdbuf(ostr.rdbuf());
SomeFunc();
char* s = ostr.str();
return s;
}
You really need to do something different with this string, and not return it; I will leave this part to you. The line pointer becomes invalid as soon as it returns, but you can make a fairly simple allocation if you free the memory after it is returned.
source
share