Go Down

Topic: how to increase pointer by 2 bytes (Read 48 times) previous topic - next topic


Jan 25, 2015, 07:54 pm Last Edit: Jan 25, 2015, 10:17 pm by smithy
Hello folks,

i want to use memcpy but the source pointer must be increased by 2 bytes because that data is parameter data not struct data.

Code: [Select]
(test = struct, msg_in = byte [])

This does not work as expected what am i doing wrong =?


All of the mem*() functions work on bytes...they could care less what they are. Please explain what you mean by "parameter data" versus "struct data". The second argument is a pointer to the base address of what is going to be copied. I have no idea what your "+2" means, The third argument is the number of bytes to be copied. That is usually an integer value or uses the sizeof() operator to determine the size. Posting all of your code would help.


Jan 25, 2015, 09:00 pm Last Edit: Jan 25, 2015, 10:19 pm by smithy
Found the soloution, FYI:

Code: [Select]
memcpy(&test,((byte*)&msg_in)+2,struct_length);The problem was i did not typecast to bytepointer and the compiler increased by struct-lentgh not by byte-length i guess.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131