为了在C++/CLR 中,将Ado.net类库返回的日志(String^ 类型),通过弹框显示出来,研究了好多,都是基本的知识点,后面再慢慢整理吧!
Std::String是C++标准库字符串类型,System::String是C++/CLR 中的类型,C#和CLR C++程序里都可以使用System::String。
将 C++\CLI 中的System:String^ 转化为MFC 中 LPCTSTR格式
#include <msclr\marshal.h>
using namespace System;
using namespace msclr::interop;
............
String^ cliString;
marshal_context context;
LPCTSTR cstr = context.marshal_as<const TCHAR*>(cliString);