Q
Hi I never used C++ before, so if the question is too basic,
please forgive me.
I am trying to implement a socket program in C++.
I know in C program when I receive a packet with some structure,
I need to parse it so as to evaluate every elements of the structure.
for example
struct A
{
int a;
int b;
}
so when I get the packet I need to parse it
memcpy(a,msg,sizeof(int));
....
So I wonder whether I need to do it in C++
or I can just claim
class C *exC = (class C*) msg
Thanks a lot!
please forgive me.
I am trying to implement a socket program in C++.
I know in C program when I receive a packet with some structure,
I need to parse it so as to evaluate every elements of the structure.
for example
struct A
{
int a;
int b;
}
so when I get the packet I need to parse it
memcpy(a,msg,sizeof(int));
....
So I wonder whether I need to do it in C++
or I can just claim
class C *exC = (class C*) msg
Thanks a lot!