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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -