views:

3480

answers:

2

How can create a byte array in objective c programming ...

i have the data that is "0x12,0x23,0x34,0x45,0x56,0x67,0x78,0x89,0x12,0x23,0x34,0x45,0x56,0x67,0x78,0x89"

i want it prepare as a byte array...

pls help me.. ...

if anybody have any sample project.. pls give me...

+5  A: 

You can simply use plain C syntax, which is available in Objective-C:

const char myByteArray[] = {
    0x12,0x23,0x34,0x45,
    0x56,0x67,0x78,0x89,
    0x12,0x23,0x34,0x45,
    0x56,0x67,0x78,0x89 };
mouviciel
Thank you very much... dear mouvicielit is working properly.
Raju
+4  A: 

Either use the plain C solution given by mouviciel or read the class description of NSData and NSMutableData.

Georg