如何从UnicodeString转换为const char *? [英] how to convert from UnicodeString into const char *?

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

问题描述





我正在构建一个IOS应用程序,我想知道如何将输入的值转换为

Edit1 - >测试(其类型为UnicodeString)到(const char *)中,以便在需要const char *作为参数的另一个函数中使用。



最好的问候。

Rania



I'm building an IOS application, and I was wondering how can I convert a value entered into
Edit1->Test (Which is of type UnicodeString) into a (const char *), in order to be used in another function that requires const char * as a parameter.

best regards.
Rania

推荐答案

字符串转换是iOS类的一个亮点,与需要的胶水代码相比较微软世界。



它很容易:

string conversion is a highlight of the iOS classes, compared with the glue code is needed in the Microsoft world.

it is so easy:
const char *cString = [@"Hello, world" UTF8String];



阅读 iOS NSString文档


const char * pszConverted = CW2A(pwstr);
const char* pszConverted = CW2A(pwstr);


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

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