Converting an NSString* to char?
40,942
Simple to transfer
const char *cfilename=[stringobject UTF8String];
Author by
ingh.am
Software Developer working in the East Riding of Yorkshire (UK). Computer Science graduate from The University of Hull with first class honours. SOreadytohelp
Updated on December 22, 2020Comments
-
ingh.am over 3 years
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!