I've done this before, but it has been a while and I am having issues finding any relevant examples. I have this legacy code:
namespace LegacyUtil {
public ref class Calc
{
public:
static int Combos(int s)
{
int t = 0;
// bunch of irrelevant loops
printf("%c%d %c%d D%d\n", m, b, a, d, z);
t++;
return t;
}
};
}
Note: I have the ability to edit/recompile this in Visual C++ if neeeded but I will have to jump through at least one hoop.
My question: how do I capture the output of the C++ calls made to printf() from within my C# code? I have this code:
int test = LegacyUtil.Calc.Combos(1040);
Executes successfully but I only get the integer returned, and I want the string output. Please help!