for the life of me i dont know how to make this work in Managed C++. what am i doing wrong
ref class Test
{
public:
static void testFunc(String^ buffer)
{
buffer = "altered";
}
};
int main(array<System::String ^> ^args)
{
Test^ testClass = gcnew Test();
String^ buf = gcnew String("some string");
Console::WriteLine("before {0}", buf); //should print "some string"
testClass->testFunc(buf);
Console::WriteLine("after {0}", buf); //should print "altered"
return 0;
}

passing and returning arguments to functions
magcianaux
jwraith
Greg J. Brown
You need to pass the handle to the String by reference
This is similar to what you would do in ISO/IEC C++ with std::string*&