J
Jason Zhang
Hi all,
If I have a program wroten in C,and defined a struct like this:
typedef struct data
{
int m_i;
int m_j;
}data;
data myData;
I send Mydata to another program via Ethernet.Just like below:
SocketObj.Send(&myData,sizeof(myData));//assume SocketObj is a Object that
can send msg via Ethernet
and the receiver is wroten in C# or VC++ 7.0 . I define a struct in it
too:
__gc class data : public Object
{
int m_i;
int m_j;
}
But ,how can I fill this class from the stream I got from Ethernet?
I tried BinaryFormatter,but I found that BinaryFormatter's format is not
pure ,
It contains may additive information.So ,BinaryFormatter does not work.
Is there any other way to solve this problem?I do not want to use
XML,although XML does work.
If I have a program wroten in C,and defined a struct like this:
typedef struct data
{
int m_i;
int m_j;
}data;
data myData;
I send Mydata to another program via Ethernet.Just like below:
SocketObj.Send(&myData,sizeof(myData));//assume SocketObj is a Object that
can send msg via Ethernet
and the receiver is wroten in C# or VC++ 7.0 . I define a struct in it
too:
__gc class data : public Object
{
int m_i;
int m_j;
}
But ,how can I fill this class from the stream I got from Ethernet?
I tried BinaryFormatter,but I found that BinaryFormatter's format is not
pure ,
It contains may additive information.So ,BinaryFormatter does not work.
Is there any other way to solve this problem?I do not want to use
XML,although XML does work.