rmathis

rmathis

  • NA
  • 10
  • 0

Can anyone help me insure this C# structure is identical to this C++ one?

Oct 13 2003 6:52 PM
Hello. I need to make an identical c# struct compared to a C++ struct. Can someone just look at the two and tell me if they should be the same size, values, etc? Here is the C++ version { 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; OK, that was the C++ version, here is my C# version. I didn't use an array for the PACKENTRY since C# doesn't allow declared arrays of another struct inside of itself. public struct PACKENTRY { public System.UInt32 packid; public long price; public long valPrice; public System.Byte byInvIndex; public System.Byte nothing; // filler to cause word alignment. public System.UInt16 numCards; public ushort packType; } public struct DBSTRUCT { public System.UInt32 crc32; public System.UInt16 recordType; public System.UInt32 dateTime; public System.UInt32 transNum; public System.UInt32 cashierNum; public System.UInt16 posNum; public System.UInt32 unitTicketNum; public System.UInt32 dwSerialNum; public System.UInt32 dwPlayerID; public System.UInt32 voidDateTime; public System.UInt32 voidCashierNum; public System.UInt16 voidReason; public System.UInt32 dwSurchargePacks; public long lSurchargePrice; public System.UInt16 numPacks; public PACKENTRY pax, pax2, pax3, pax4, pax5, pax6, pax7, pax8, pax9, pax10, pax11, pax12, pax13, pax14, pax15, pax16, pax17, pax18, pax19, pax20; public PACKENTRY pax21, pax22, pax23, pax24, pax25, pax26, pax27, pax28, pax29, pax30, pax31, pax32, pax33, pax34, pax35, pax36, pax37, pax38, pax39, pax40; public PACKENTRY pax41, pax42, pax43, pax44, pax45, pax46, pax47, pax48, pax49, pax50, pax51, pax52, pax53, pax54, pax55, pax56, pax57, pax58, pax59, pax60; public PACKENTRY pax61,pax62, pax63, pax64; } Thanks in advance for anyone willing to spend some time helping me with this issue!

Answers (4)