hi, not have programming background. in following obj-c code create array of bytes must convert bytes string hex format work further. not idea. create array in c directly without converting string. how can it? thank you! in obj-c + c: nsdata *data = [nsdata datawithcontentsoffile:file]; const unsigned char *bytes = [data bytes]; for (int = 0; < [bytes count]; i++) { unsigned char array = (int)bytes; // in c } printf("array: %d", array); php:
nsdata * data = [ nsdata datawithcontentsoffile : file ]; const unsigned char * bytes = [ data bytes ]; nsmutablearray *array = [ nsmutablearray array]; for ( int i = 0 ; i < [ bytes count ]; i ++) { nsstring * bytesasstring = [ nsstring stringwithformat :@ "%02x" , (int) bytes [ i ]]; [array addobject : bytesasstring ]; } nslog (@ "%@" , array);
it seems me second line gets array of bytes. don't think you're expressing need data start , want enough. -lee
Forums Macs Mac Programming
iPhone Mac OS & System Software iPad Apple Watch Notebooks iTunes Apple ID iCloud Desktop Computers Apple Music Professional Applications iPod iWork Apple TV iLife Wireless
Comments
Post a Comment