How do I initialize a fixed byte array?

Posted by Jurily on Stack Overflow See other posts from Stack Overflow or by Jurily
Published on 2010-05-31T07:04:39Z Indexed on 2010/05/31 7:12 UTC
Read the original article Hit count: 235

Filed under:
|
|
|

I have the following struct:

[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct cAuthLogonChallenge
{
    byte cmd;
    byte error;
    fixed byte name[4];

    public cAuthLogonChallenge()
    {
        cmd = 0x04;
        error = 0x00;
        name = ???
    }
}

name is supposed to be a null-terminated ASCII string, and Visual Studio is rejecting all my ideas to interact with it. How do I set it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about beginner