code:
const char sbyte[] = {65, 66};
NSLog(@"byte:%c", 66);
NSLog(@"byte:%c", 67);
NSLog(@"byte:%s", sbyte);
NSString *string1 = [[NSString alloc] initWithCString:sbyte encoding:NSUTF8StringEncoding];
NSLog(@"string1: %@", string1);
NSString *string2 = [NSString stringWithFormat:@"%s", sbyte];
NSLog(@"string2: %@", string2);
print:
byte:B
byte:C
byte:ABb
string1: ABb
string2: ABb
The correct application is 'AB', but now it is 'ABb', one more character 'b'??
thanks!