【问题标题】:How to convert char * to a System::string ^ [duplicate]如何将 char * 转换为 System::string ^ [重复]
【发布时间】:2010-08-06 13:01:55
【问题描述】:

可能重复:
What is the best way to convert between char* and System::String in C++/CLI

你好, 我在使用 \clr 的 c++ 项目中有一个函数,例如:

int WINAPI dmtTest(char *pcertificate) 
{    
    String^ sCertificate;    
    sCertificate = pcertificate; // how can I assign pcertificate to sCertificate?
    ....
}

【问题讨论】:

    标签: string c++-cli


    【解决方案1】:

    你可以这样做:

    String^ sCertificate;
    sCertificate = gcnew String(pcertificate);
    

    【讨论】:

    • 这行得通...试图找到相反的方向(字符串到 Char*)...
    猜你喜欢
    • 2011-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-10
    • 2012-10-31
    相关资源
    最近更新 更多