Sign in to follow this  

memcpy() for Vertex Stuffing prob

This topic is 4566 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm getting this compilation error on my memcpy() line: error C2664: 'memcpy' : cannot convert parameter 2 from 'sVertex' to 'const void *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called memcpy(Ptr, Particles[i].Verts[j], sizeof(sVertex)); I'm looking at the DX RolePlaying games book, and I see the difference in our code. He's using an unnamed typedef struct for his vertex, but I'm using a named struct with a set() function as well. So the structure isn't of (void*) type, and it won't let me use a (void*) explicit typecast. Can anyone help me here?

Share this post


Link to post
Share on other sites
memcpy(Ptr, (void *)&Particles[i].Verts[j], sizeof(sVertex));

I'm assuming that Verts is an array of vertices, in which case [j] increments and dereferences the pointer, so you need to get the address back before casting to void*. I'd be surprised if that's the exact code in the book, chances are you made a mistake somewhere.

Share this post


Link to post
Share on other sites

This topic is 4566 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this