Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Byte array in objective-c

How can I create a byte array in Objective-C?

I have some data like this:0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, that I want to prepare as a byte array.

like image 680
Raju Avatar asked May 18 '09 07:05

Raju


1 Answers

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 };
like image 184
mouviciel Avatar answered Sep 19 '22 09:09

mouviciel