I'm trying to write code in C++ that loads .3ds files. .3ds files use floats in binary for vertex coordinates, but I don't know how to read them. I googled stuff for a bit, until it seemed like reinterpret_cast was the way to do it, but this code
Expand|Select|Wrap|Line Numbers
- float readFloat(ifstream& file) {
- char bytes[sizeof(float)];
- for (int i = 0; i < sizeof(float); i++)
- bytes[i] = file.get();
- return reinterpret_cast<float>(bytes);
- }
invalid reinterpret_cast from type `char*' to type `float'
Do any of you know how to read a float from a file? I will appreciate any help you can give me.