Pointers & arrays in Structures

  • Thread starter Thread starter vatsa
  • Start date Start date
V

vatsa

In some C++ code the follwoing two structures
are existing

typedef struct _STD_DB_TRAILER
{
WORD wSpare1;
DWORD dwSpare1;
char sSpare1[60];
} STD_DB_TRAILER;

typedef struct _WP_BLOB
{
unsigned int size;
char * data;
}WP_BLOB;

These are intialized and the data is serialized into a
blob in the database

Now in my C# project i need to read the blob from database
and de-serialize them to their respective structures
and retrieve data from individual elements

I tried something like this which obviously did not work
private struct STD_DB_TRAILER
{
System.UInt16 wSpare1;
System.UInt32 dwSpare1;
char[] strSpare1; //actually the size had to fixed to 60
}

public struct WP_BLOB
{
public System.UInt32 size;
public System.Char[] uChars; //I need to have a char*
}

how do i do this any suggestions ?
thanks
 
Back
Top