Issues with declaring struct arrays inside of a struct

R

Richard Mathis

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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top