以下是我从网上下的SNMP++NET中的部分代码,执行老出错,请高手帮忙解决,特急
出错语名是 auto_ptr<char> scopy(new char[length+1 ]);
我不懂c++全靠大家了,s="127.0.0.1"或其它
char* Mao::DotNet::NetString2Chars(String* s) { if (!s) {
throw new ArgumentNullException(S"s");
} // use auto_ptr<> as StringToHGlobalAnsi() may throw an exception
int length = s->Length;
auto_ptr<char> scopy(new char[length+1 ]);
if (!scopy.get()) {
throw new UnmanagedOutOfMemoryException();
} const char* chars = (const char*)
Marshal::StringToHGlobalAnsi(s).ToPointer();
::strcpy(scopy.get(), chars);
Marshal::FreeHGlobal(IntPtr((void*) chars)); return scopy.release();
}