将System :: String *转换为char * [英] Convert System::String* to char*

查看:108
本文介绍了将System :: String *转换为char *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有人知道如何将System :: String *转换为char *吗?我搜索了System :: String类成员,但没有找到任何成员。谢谢


一帆

Hi

Does anybody know how to convert System::String* to char*? I searched the System::String class members and did not find any. Thanks

Yifan

推荐答案

" Yifan" <一个******* @ discussions.microsoft.com>在消息中写道

新闻:EA ********************************** @ microsof t.com ...
"Yifan" <an*******@discussions.microsoft.com> wrote in message
news:EA**********************************@microsof t.com...
有人知道如何将System :: String *
转换为char *吗?我搜索了System :: String类
成员并没有找到任何。
Does anybody know how to convert System::String*
to char*? I searched the System::String class
members and did not find any.




检查文档中PtrToStringChars()的含义


问候,




Check the docs for the meaning of PtrToStringChars()

Regards,
Will


PtrToStringChars()返回System :: Char *。但我想将System :: String *转换为char *,它是一个c型字符串,例如hello。谢谢


Yifa


----- William DePalo [MVP VC ++]写道:----

一帆 <一个******* @ discussions.microsoft.com>在消息中写道

新闻:EA ********************************** @ microsof t.com ..
PtrToStringChars() returns System::Char*. But I want to convert System::String* to char* which is a c-type string such as "hello". Thanks

Yifa

----- William DePalo [MVP VC++] wrote: ----

"Yifan" <an*******@discussions.microsoft.com> wrote in messag
news:EA**********************************@microsof t.com..
有谁知道如何将System :: String
转换为char *?我搜索了System :: String clas
成员并没有找到任何
Does anybody know how to convert System::String
to char*? I searched the System::String clas
members and did not find any




检查文档以了解PtrToStringChars的含义(

问候

Wil



Check the docs for the meaning of PtrToStringChars(

Regards
Wil


" Yifan" a ******* @ discussion .microsoft.com>在留言中写道

新闻:1D ******************************* *** @ microsof t.com ...
"Yifan" <an*******@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
PtrToStringChars()返回System :: Char *。但是
我想将System :: String *转换为char *,其中
是一个c型字符串,例如hello。
PtrToStringChars() returns System::Char*. But
I want to convert System::String* to char* which
is a c-type string such as "hello".




请参阅Win32的WideCharacterToMultiByte()或运行时的wcstombs()。 />

同时检查DllImport属性及其CharSet成员的文档,其中

可用于标记您希望调用的外部DLL中的函数。 br />

问候,




See Win32''s WideCharacterToMultiByte() or the runtime''s wcstombs().

Also check the docs for the DllImport attribute and its CharSet member which
can be used to "tag" functions in external DLLs that you wish to call.

Regards,
Will


这篇关于将System :: String *转换为char *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆