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

前端 未结 3 1622
终归单人心
终归单人心 2020-12-19 08:11

In C#, I can specify a fixed sized buffer using the fixed keyword, like so:

public unsafe struct StructWithFixedBuffer
{
    public fixed char F         


        
3条回答
  •  借酒劲吻你
    2020-12-19 08:32

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

提交回复
热议问题