The exact structure of the struct is not important.
From what I gather the following c code is reading a "chunk" of binary data (equal to the size of the struct) and directly writing that to a struct (i.e first 32 bytes to name, next 2 bytes to attrib, etc). Is there any equivelent in C# managed code?
Please provide a code snipet showing similar outcome. To save time you can simplify the to only a few elements and assume the appropriate filestream type object is already initialized.
Note: I will be consuming an existing legacy data file so the formatting/packing of the existing data file is important. I can't for example just use .net serialization / deserization because I will be processing legacy existing files (changing format is not feasible).
typedef struct _PDB
{
char name[32];
unsigned short attrib;
unsigned short version;
unsigned int created;
unsigned int modified;
unsigned int backup;
unsigned int modNum;
unsigned int nextRecordListID;
unsigned short numRecs;
} PDB;
void getFileType(FILE *in)
{
PDB p;
fseek(in, 0, SEEK_SET);
fread(&p, sizeof(p), 1, in);
. . .
}