3
如何在Objective-C数组中存储Objective-C++ short int并将其稍后转换回Objective-C++?我尝试了以下但没有成功。任何帮助将是伟大的!从Objective-C++存储/检索值到Objective-C
short int *tmpbuffer = (short int*)malloc(sizeof(short int)*length*inData);
int count = 0;
for (count = 0; count < length*inData; count++)
{
tmpbuffer[count] = (short int) (inbuffer[count] * 0x7fff);
}
size = fwrite(tmpbuffer, 1, sizeof(short int)*length*inData,fp);
[fwriteSections addObject:[NSNumber numberWithShort:tmpbuffer]];
[fwriteSections addObject:[NSNumber numberWithShort:sizeof(short int)*length*inchannels]];
[fwriteRows addObject:fwriteSections];