Jump to content
  • Advertisement
Sign in to follow this  
Ace826

Another cast question.....

This topic is 5415 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

Ok, so i have a struct..... lets say.... struct _VERTEX { float z, y, z; } VERTEX; now, I have created a memory mapped file. MapViewOfFile returns LPVOID. How can i cast the LPVOID to VERTEX? I am asking this because i want to take stuff from the file, and have it read like vertex. File will be all binary structured like..... [x][y][z][x][y][z][x][y][z] |-------| | I would like to be able to read this part of the file using a memory mapped file.... argh... if I am not making any sense please let me know. I will try and make it clearer. thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement

void *pData;
_VERTEX *pVertices = (_VERTEX*) pData;

// or (in C++) to be more specific
_VERTEX *pVertices = reinterpret_cast<_VERTEX*>(pData);



You can then treat pVertices as an array.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!