D
Dean L. Howen
Hi friends,
In C++, we can declare a struct and write it into file just by giving the
address the strct instance (using &).
for example:
/////////////////////////////////
typedef struct Test
{
int intV;
char charV[8];
float floatV;
};
// create a struct
Test ts;
ts.intV = 100;
strcpy(ts.charV, "12345678");
ts.floatV = 99.99;
CFile f;
....
f.Write(&ts, sizeof(TEST)); <-->
....
////////////////////////////
My question is:
in C#, could we read/write a struct/class from/to file?
how to convert a class/struct to an array?
In C++, we can declare a struct and write it into file just by giving the
address the strct instance (using &).
for example:
/////////////////////////////////
typedef struct Test
{
int intV;
char charV[8];
float floatV;
};
// create a struct
Test ts;
ts.intV = 100;
strcpy(ts.charV, "12345678");
ts.floatV = 99.99;
CFile f;
....
f.Write(&ts, sizeof(TEST)); <-->
....
////////////////////////////
My question is:
in C#, could we read/write a struct/class from/to file?
how to convert a class/struct to an array?