Another cast question.....

Started by
1 comment, last by Ace826 19 years, 7 months ago
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.
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.
Thanks! That worked really well. :).

This topic is closed to new replies.

Advertisement