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 阅读(259) 评论(0)  编辑 收藏 引用


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


导航

<2008年2月>
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678

统计

常用链接

留言簿(1)

随笔档案

搜索

最新评论