I have a binary file created using C++ that contains an object of the
structure:
struct student
{
int roll_no;
char name[20];
char qualification[50];
};
the following code is used to create and write to the file:
void WriteToFile()
{
student s;
s.roll_no=1;
strcpy(s.name," nand");
strcpy(s.qualif ication,"MCA");
CString fileName = "c:\\testdata.d at";
CFile file;
file.Open(fileN ame,CFile::mode Create | CFile::modeWrit e |
CFile::typeBina ry);
file.Write(&s,s izeof(s));
}
Now, I want to read the contents of this binary file (testdata.dat) using a
C# program and store that in a C# structure. Can any body suggest me how to
do this. Sample code would be highly appreciated.
Thanks
--
Nand Kishore Gupta
structure:
struct student
{
int roll_no;
char name[20];
char qualification[50];
};
the following code is used to create and write to the file:
void WriteToFile()
{
student s;
s.roll_no=1;
strcpy(s.name," nand");
strcpy(s.qualif ication,"MCA");
CString fileName = "c:\\testdata.d at";
CFile file;
file.Open(fileN ame,CFile::mode Create | CFile::modeWrit e |
CFile::typeBina ry);
file.Write(&s,s izeof(s));
}
Now, I want to read the contents of this binary file (testdata.dat) using a
C# program and store that in a C# structure. Can any body suggest me how to
do this. Sample code would be highly appreciated.
Thanks
--
Nand Kishore Gupta
Comment