objective c - How to convert NSString to C string? -
objective c - How to convert NSString to C string? -
i know question possible duplicate, after looking @ google tutorials , questions on forum none of them gives me decent reply subject.
i have:
nsstring *str = @"text";
and like:
char cstring [512] = str;
(this shows want do, after looking @ apple's nsstring class ref didn't think using it).
up have:
char command [512] = [[nsstring stringwithformat:@"text"] cstringusingencoding:nsutf8stringencoding];
still, errors.
any solution?
try const char *command = [str utf8string];
objective-c
Comments
Post a Comment