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];