Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2005, 12:27:19 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: importer: no more fstream c-style code only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/objModel.cc

    r3908 r3909  
    2323
    2424#define PARSELINELENGTH 8192
    25 
    26 #include <fstream>
    2725
    2826#include "debug.h"
     
    6967  this->objFileName = NULL;
    7068  this->mtlFileName = NULL;
    71 
    72   this->initialize();
    7369}
    7470
     
    135131  char readLine[PARSELINELENGTH];
    136132  char buffer[PARSELINELENGTH];
    137   int i = 0;
    138133  while(fgets(readLine, PARSELINELENGTH, stream))
    139134    {
    140135      strcpy(buffer, readLine);
    141       i++;
    142136      // case vertice
    143137      if (!strncmp(buffer, "v ", 2))
     
    206200 
    207201
    208   PRINTF(4)("Opening mtlFile: %s\n", fileName);
    209 
    210   ifstream* MTL_FILE = new ifstream (fileName);
    211   if (MTL_FILE->fail())
    212     {
    213       PRINTF(2)("unable to open file: %s\n", fileName);
    214       MTL_FILE->close();
    215       delete []fileName;
    216       delete MTL_FILE;
     202  FILE* stream;
     203  if( (stream = fopen (fileName, "r")) == NULL)
     204    {
     205      printf("IniParser could not open %s\n", fileName);
    217206      return false;
    218207    }
    219   char buffer[500];
     208
     209  char readLine[PARSELINELENGTH];
     210  char buffer[PARSELINELENGTH];
    220211  Material* tmpMat = material;
    221   while(!MTL_FILE->eof())
    222     {
    223       MTL_FILE->getline(buffer, 500);
     212  while(fgets(readLine, PARSELINELENGTH, stream))
     213    {
    224214      PRINTF(5)("found line in mtlFile: %s\n", buffer);
    225      
    226215
    227216      // create new Material
     
    286275
    287276    }
    288   MTL_FILE->close();
     277  fclose(stream);
    289278  delete []fileName;
    290   delete MTL_FILE;
    291279  return true;
    292280}
Note: See TracChangeset for help on using the changeset viewer.