Issues with declaring struct arrays inside of a struct

Discussion in 'ASP .Net Building Controls' started by Richard Mathis, Oct 10, 2003.

  1. I have the following C++ code:

    define MAXXPAXX 64

    // Pack sub component of database struct.
    typedef PREFIX_PACKED struct
    {
    DWORD packid;
    long price;
    long valPrice;
    BYTE byInvIndex;
    BYTE nothing; // filler to cause word alignment.
    WORD numCards;
    WORD packType;
    } PACKED PACKENTRY;

    // Database struct
    typedef PREFIX_PACKED struct
    {
    DWORD crc32;

    WORD recordType;
    DWORD dateTime;
    DWORD transNum;
    DWORD cashierNum;
    WORD posNum;
    DWORD unitTicketNum;
    DWORD dwSerialNum;
    DWORD dwPlayerID;

    DWORD voidDateTime;
    // if !voidDateTime
    // if DB_REC_NORM, voidReason == additinoal pack unit ID
    // if DB_REC_ADDPACK voidReason == additinoal pack unit ID
    // if DB_REC_ADDPACK voidCashierNum == original unitTicket
    // if void ticket and is DB_REC_ADDPACK
    // relink master and additionals.
    // if void ticket is DB_REC_NORM and has additional packs
    // All additional packs are voided.
    #define unitLinkBase voidCashierNum
    DWORD voidCashierNum;
    #define unitLinkNext voidReason
    WORD voidReason;

    DWORD dwSurchargePacks;
    long lSurchargePrice;

    WORD numPacks;
    PACKENTRY pax[MAXXPAXX];
    } PACKED DBSTRUCT;
    typedef DBSTRUCT FAR * LPDBSTRUCT;

    While I am somewhat concerned about the keyword PACKED (does it have
    any bearing to me, does it matter or can I ignore it?), my primary
    concern is how to declare

    PACKENTRY pax[MAXXPAXX];

    in C#, as C# doesn't allow declared arrays in structs. I've been
    working with something like
    [MarshalAs(PACKENTRY, SizeConst=64)]
    byte[] pax; But of course C# is looking for a variable instead of
    PACKENTRY. Anyway, anyone have any ideas?

    Thanks in advance,
     
    Richard Mathis, Oct 10, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Friday
    Replies:
    35
    Views:
    5,569
    Friday
    May 10, 2005
  2. JNY
    Replies:
    6
    Views:
    281
    Keith Thompson
    Dec 29, 2004
  3. joe
    Replies:
    3
    Views:
    354
  4. andreyvul

    Declaring structs with anonymous arrays

    andreyvul, Sep 30, 2008, in forum: C Programming
    Replies:
    7
    Views:
    439
    andreyvul
    Sep 30, 2008
  5. Philipp
    Replies:
    21
    Views:
    1,174
    Philipp
    Jan 20, 2009
Loading...

Share This Page