View topic - Data is corrupting when address sent to another module

Page 1 of 1

Data is corrupting when address sent to another module

PostPosted: Wed Feb 08, 2012 6:26 am
by pramodama
Hi All,

I am sending adress to another module where address remains same but data is corrupted by adding the data (Hex BC 55 36 70) to beginning of the data. Please do help me to find out the reason for this and the meaning of this.

Code snippet:
void *ptr;

sendToFunc((char*)ptr) (data is "I am Pramod")

in other module:
ptr printed (here data is BC 55 36 70 P r a m o d )

Always same 4 byte data is added to beginning. Please let us know about this.

Regards,
Pramod

Re: Data is corrupting when address sent to another module

PostPosted: Wed Feb 08, 2012 2:51 pm
by mario
Post exact code because there must be a bug in it. Without detail it's impossible to tell.

Re: Data is corrupting when address sent to another module

PostPosted: Wed Feb 08, 2012 8:57 pm
by maschoen
Keep in mind if you are sending a structure that the default GNU behavior is to pad so that the items in the structure are word (4byte) aligned.