我有一个运行时组件,我需要某个给定Platform::Array<uint16>
的原始指针int16*
。像int16 buffer[20]
,但我不知道编译时的大小。如何将Platform :: Array <uint16>转换为raw int16 *
我怎样才能得到这个没有给缓冲区一个固定的大小?
ConvertArray(const Platform::Array<uint16>^ bytes)
{
int16 buffer[bytes->Length]; // doens't work
int16 buffer[20]; // works, but I never know what size it needs to be
....
}
任何建议如何做到这一点?
使用'std :: vector'。或'平台::数组' –
leemes
2014-10-18 12:16:26
我真的需要一个'int16 []'因为我使用的第三个pary库(旧c)只有'int16 const * data' – 2014-10-20 07:08:49
这并不意味着你不能使用一个向量来存储*它。你可以用'.data()'从vector获得原始指针。也许可以用'Platform :: Array'完成同样的工作(我不知道该怎么说),所以你根本不需要做任何转换。 – leemes 2014-10-20 10:32:54