Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Issues with declaring struct arrays inside of a struct

Reply
Thread Tools

Issues with declaring struct arrays inside of a struct

 
 
Richard Mathis
Guest
Posts: n/a
 
      10-10-2003
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,
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multidimensional arrays and arrays of arrays Philipp Java 21 01-20-2009 08:33 AM
Declaring structs with anonymous arrays andreyvul C Programming 7 09-30-2008 09:36 PM
Declaring Multi-Dimensional Arrays joe C++ 3 12-13-2006 04:50 AM
Declaring/populating variable arrays in ASP.NET??? Friday ASP .Net 35 05-10-2005 06:24 PM
declaring arrays with variable indeces JNY C Programming 6 12-29-2004 12:44 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57