Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memcpy w/ an offset?

Status
Not open for further replies.

Wizumwalt

Programmer
Jul 12, 2005
10
0
0
If I have a buffer of 4 doubles that i just read from a socket, how do I copy the 3rd double into a value by itself? There's no delimiters, just serialized data that I read in.

Is there something like a memcpy w/ an offset somehow?
 
What's the datatype of the buffer?
If it's something like a char* buffer, you should be able to just cast it:
Code:
char* buf;
...
double value = ((double*)buf)[2];
or
double value = *(((double*)buf) + 2);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top