To print char * in NSLog, try the following:
char data[6] = {'H','E','L','L','0','\n'}; NSString *string = [[NSString alloc] initWithUTF8String:data]; NSLog(@"%@", string);
You need to null complete the string.
From the Apple documentation:
- (instancetype)initWithUTF8String:(const char *)nullTerminatedCString;
Returns an NSString object initialized by copying characters from the given array C from UTF8 encoded bytes.
source share