How do I specify a fixed-size buffer in C++/CLI?

一个人想着一个人 提交于 2019-11-29 11:17:32

One of the C++/CLI developer blogs had code for a template solution to this, I'll try to find a link.

Ahh, found it. It's called inline_array.

The C# syntax was added as a way to express the C++ syntax you've know forever. :)

public:
    wchar_t FixedBuffer[128];

Quote:

size of the 128 element char array is 256 bytes. Fixed size char buffers always take two bytes per character, regardless of the encoding.

So you want:

struct StructWithFixedBuffer
{
    char FixedBuffer[128*2];
};
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!