Come posso creare un array di byte in Objective-C?Byte array in ogg-c
Ho alcuni dati come questo: 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89
, che voglio preparare come array di byte.
Come posso creare un array di byte in Objective-C?Byte array in ogg-c
Ho alcuni dati come questo: 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89
, che voglio preparare come array di byte.
Si può semplicemente utilizzare la sintassi C pianura, che è disponibile in Objective-C:
const char myByteArray[] = {
0x12,0x23,0x34,0x45,
0x56,0x67,0x78,0x89,
0x12,0x23,0x34,0x45,
0x56,0x67,0x78,0x89 };
utilizzare la soluzione C pianura data dal mouviciel o leggere la descrizione della classe di NSData
e NSMutableData
.
Questi collegamenti devono essere aggiornati - NSData: https://developer.apple.com/documentation/foundation/nsdata - NSMutableData: https://developer.apple.com/documentation/foundation/nsmutabledata – whyoz
Grazie mille ... cara mouviciel funziona correttamente. – Raju
qual è la differenza se è stato utilizzato un char senza segno? – whyoz