CLR 字符转换

转换宏:

1#define CLRS2A(x , v) \
2    v = (char *)((int)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(x));
3



应用:

1    char *ms_tocrl = "Hello World!";
2    System::String ^str = gcnew System::String(ms_tocrl);
3    char *buff;
4    CLRS2A(str,buff);
5    cout<<buff;
6    // printf : Hello World!

posted on 2008-02-18 15:50 Viweei 阅读(258) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理


导航

<2026年6月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿(1)

随笔档案

搜索

最新评论