Click here to Skip to main content
14,766,261 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

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
Posted
Comments
Richard MacCutchan 11-May-14 13:23pm
   
You need to find a conversion function that will turn Unicode characters into ASCII. In Windows you can use WideCharToMultiByte function, but I am not sure what the iOS equivalent would be.

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];

read the iOS NSString Documentation
   
const char* pszConverted = CW2A(pwstr);
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900