   Loading Vertices
  Ugh I''ve been trying for hours to load my vertices from my custom mesh file into a vertex buffer, but I''m having trouble figuring out the best stream to load the file with and what assignment is needed to get it into an array of vertices.  If that doesn''t make any sense I''m sorry, but I''m rather exhausted and giving up for the night.  Hopefully someone has an answer that will make sense in the morning.My mesh file is very basic.NumberOfFaces, NumberOfVertices[x1,y1,z1],[x2,y2,z2],[x3,y3,z3],...and then the faces: [v3, v6, v8],[v1,v2,v4],...I know I''m going to kick myself when I see how easy it is. 
  It actually isn't that hard to read data from a file as one might think. typedef struct _vertex{   float x, y, z;} vertex, *vertex_ptr;typedef struct _face{   int vertex1, vertex2, vertex3;} face, *face_ptr;intiNumVerts = 0;intiNumFaces = 0;inti    = 0;vertex* pVerts    = NULL;face*   pFaces    = NULL;// Open up the file for readingFILE* pFile = fopen( "customfile.ext", "rb" );// Read in the faces and verticesfread( &iNumFaces, sizeof(int), 1, pFile );fread( &iNumVerts, sizeof(int), 1, pFile );// Allocate memory to hold our datapVerts = new vertex[iNumVerts];pFaces = new face[iNumFaces];// Read in all our verticesfor( i = 0; i < iNumVerts; i++ ){   fread( &pVerts[i].x, sizeof( float ), 1, pFile );   fread( &pVerts[i].y, sizeof( float ), 1, pFile );   fread( &pVerts[i].z, sizeof( float ), 1, pFile );}// Read in the stored faces informationfor( i = 0; i < iNumFaces; i++ ){   fread( &pFaces[i].vertex1, sizeof( int ), 1, pFile );   fread( &pFaces[i].vertex2, sizeof( int ), 1, pFile );   fread( &pFaces[i].vertex3, sizeof( int ), 1, pFile );}// Done with our file, so close itfclose( pFile ); Wrote this down while at work, and the phone was going hot so I might have made some mistakes in the code somewhere.Otherwise it should be easy to understand.Hope it helps,- Patrik WillboAuburn / Auburn - The Final Project (Horror/Adventure) The Lord says He can get me out of this mess, but He's pretty sure you're fucked.- Stephen (Braveheart) [edited by - Willbo on February 14, 2004 4:49:05 PM];  If I understand the OP correctly, he is using a text file representation of his mesh, not binary data (which is admittedly much easier to read). ;  If it''s a simple text file you could, if the file is devided into lines that is, read in each line with fgets then just scan that string with sscanf in basically the same way as the previous code read in the binary data representation. The Lord says He can get me out of this mess, but He''s pretty sure you''re fucked.- Stephen (Braveheart) ;  Code works great! Thanks so much.  It would''ve taken me forever to figure that out.  Binary is fine for my purposes.  I just need the data.  Thanks again. 