i have a array with two strings:
NSArray *sendingArray = [[NSArray alloc]initWithObjects:@"CAT",@"DOG",nil];
and i converted the array to NSData:
NSData *myData = [NSKeyedArchiver archivedDataWithRootObject:sendingArray];
now i need to convert my NSData(myData)
to const uint8_t
i am doing this code to send an array of values through Wifi network.
i send successfully a string over wifi using the below code(my string is "string").
const uint8_t *message = (const uint8_t *)[string UTF8String];
[_outStream write:bytes maxLength:len];
i wrote the below code to send NSData object but it got error.
code is:
const uint8_t *bytes = (uint8_t)[myData bytes];//this line getting error.
[_outStream write:bytes maxLength:len];
can i send my NSData(myData)
through the above method without converting it to const uint8_t? if yes,please give me the code that i need to write.
or can any one tell me the way to convert my NSData(myData)
to const uint8_t
const uint8_t *bytes = (const uint8_t*)[myData bytes];
// ^^ note the asterisk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With