If I have
NSString *myString = @"string for data1"
const char *utfMyString = [myString UTF8String];
NSLog(@"length of my myString is %d",[myString length]);
NSLog(@"length of my utfMyString is %lu",strlen(utfMyString));
I looked up the definition of method UTF8String which returns a null terminated at the end for the receiver. Therefore, i think length of utfMyString should be 17.
Unfortunately, utfMyString still is length of 16.
Please correct me about this issue. Thanks a lot
strlen()doesn’t include the terminating null character in its length count.