I am trying to send a string terminated with \0 to a tcp socket but it seems the \0 does never reach its destination.
Using this code:
NSString* s=@"<b/> \0_";
uint8_t *buf = (uint8_t *)[s UTF8String];
int resCode = [outputStream write:buf maxLength:strlen((char *)buf)];
I only seem to send @"<b/> "
. Probably the \0
is seen as the end of the uint8_t
.
Can someone tell me how it should be done??