Structure in C++:
typedef struct _denom
{
CHAR cCurrencyID[3];
int ulAmount;
short usCount;
LPULONG lpulValues; //pointer to array of ULONGS
int ulCashBox;
} DENOMINAT, * LPDENOMINAT;
Structure in C#:
[ StructLayout( LayoutKind.Sequential,
CharSet=CharSet.Ansi, Pack=1 ) ]
public struct DENOMINAT
{
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=3 ) ]
public char[] cCurrencyID;
public int ulAmount;
public short usCount;
public IntPtr lpulValues;
public int ulCashBox;
}
lpulValues
is a pointer to array of ulongs and its array size is based on the usCount
for eg :if uscount is 5 then in C++ it would be lpulValues = new ULONG[usCount];
.
I can easily get the array values in C++ which is not been possible in C#.I dont understand how to get the array values through IntPtr
.
Thanks in advance.