objective c - what is getShort( ) in android? -
i trying convert below android code objective c code
short shvalue = buffer.getshort(shindex_);
buffer: bytearray. order little_endian.
what mean , how can achieve in objective-c? tried below code.
nsdata * testdata = [nskeyedarchiver archiveddatawithrootobject: [buffer objectatindex:shindex_]]; typedef struct mystruct { uint16_t starttime; } mystruct; mystruct sample; [testdata getbytes:&sample length:sizeof(sample)]; sample.starttime = cfswapint16hosttolittle(sample.starttime); nslog(@"sample%u",sample.starttime);
but not getting me correct result.
Comments
Post a Comment