Reputation: 796
how do you encode a NULL char (\000) into NSData ? I cannot fathom how to do this. I ultimately want this to be part of a larger data string that I construct, but I can't figure out how to bring it in.
Upvotes: 1
Views: 1430
Reputation: 135550
NSMutableData *data = [NSMutableData data];
unsigned char zeroByte = 0;
[data appendBytes:&zeroByte length:1];
Upvotes: 6