Reputation: 26812
How can I convert a NSString* into a char?
EDIT: Thanks to Vladimir for getting me there!
NSString *myString = @"HelloWorld";
const char *stringAsChar = [myString cStringUsingEncoding:[NSString defaultCStringEncoding]];
Hope this helps someone in the future!
Upvotes: 35
Views: 45417
Reputation: 6708
Simple to transfer
const char *cfilename=[stringobject UTF8String];
Upvotes: 68