Thank you _Mike. I understood well.
Type: Posts; User: securelinprog
Thank you _Mike. I understood well.
Thank you _Mike.
Which parameter determine dsize was 4 or 0? Does size of msg->data and buf->data is effective?
Thank you very much.
Ok, right.
I understand why using msg->dsize in the memcpy function.
By using it, can copy all buf structure to msg->data and msg->dsize simultaneously.
Thanks to all specially sganesh.
you don't ask answer of my question. I ask why using msg->dsize in first parameter of memcpy?
your written code only copy all one structure to another one.
however, i thank you for it.
Thank you.
if change size of msg->data from 100 to 2 and then try to copy buffer to msg, msg->dsize will be
invalid. I don't know what msg->dsize will has, I only know it will be invalid.
If...
memcpy function is used for copy to dst from src with size:
memcpy(dst, src, size)
If msg structure was defined as follow:
struct msg{
char data[100];
int dsize;
}