VS2010 hates me

Edit: Forgot to open the file as binary... grr

I have this code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
bool Model::read(std::ifstream& input){

  unsigned int count = 0;
    
  READ(amtVertices);  // READ = if not good read, return false
  count = amtVertices / (sizeof(Vertex)/sizeof(float));
  vertices = new (std::nothrow) Vertex[count];
  if (!vertices){  std::cout << "Could not create vertices: "; return false; }
  input.read(reinterpret_cast<char*>(vertices), sizeof(vertices[0]) * count);
  
  READ(amtNormals);
  count = amtNormals / (sizeof(Vertex)/sizeof(float));
  normals = new  (std::nothrow) Vertex[count];
  if (!normals){  std::cout << "Could not create normals: "; return false; }
  input.read(reinterpret_cast<char*>(normals), sizeof(normals[0]) * count);
  report();  // Prints contents of model to file

  //Rest of function 


Which works fine when compiled with MinGW. When I use it in VS2010, my "normals" starts to be junk data about 80 values in. Can't for the life of me figure it out... Same code, same file...

Last edited on
Topic archived. No new replies allowed.