Changeset 8535 in orxonox.OLD for branches/bsp_model/src/lib/graphics
- Timestamp:
- Jun 16, 2006, 3:48:22 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_animation_cfg.cc
r8534 r8535 21 21 #include "debug.h" 22 22 23 #include <stdio.h> 24 #include <stdlib.h> 25 23 26 using namespace std; 24 27 … … 40 43 MD3AnimationCfg::MD3AnimationCfg(std::string filename) 41 44 { 42 this->dataStream.open(filename.c_str()); 43 44 if( !this->dataStream) { 45 PRINTF(1)("Error: file could not be opened: %s\n", filename.c_str()); 46 return; 47 } 45 48 46 49 47 this->loadConfig(filename); … … 72 70 73 71 72 //this->dataStream.open(filename.c_str()); 73 FILE* pFile; 74 char* cLine; 75 size_t len = 0; 76 ssize_t read = 0; 77 78 PRINTF(0)("opening file: %s\n", filename.c_str()); 79 pFile = fopen(filename.c_str(), "r"); 80 if( !pFile) { 81 PRINTF(1)("Error: file could not be opened: %s\n", filename.c_str()); 82 return; 83 } 84 74 85 75 86 // parse file 76 this->dataStream.getline(buffer, 1024, '\n');77 std::string line(buffer);78 PRINTF(0)("line = %s\n", line.c_str());79 while( !this->dataStream.eof()) {87 // this->dataStream.getline(buffer, 1024, '\n'); 88 // std::string line(buffer); 89 while( (read = getline(&cLine, &len, pFile)) != -1) { /*( !this->dataStream.eof()) {*/ 90 std::string line(cLine); 80 91 81 92 //ignore empty lines and comments … … 84 95 if( inHeader && line.find("sex") == 0) { 85 96 //parse line: sex [m | f | ...] 86 // StringTokenizer st=new StringTokenizer(line, " \t\n\r\f/");87 97 std::vector<std::string> tokens; 88 98 Tokenizer::tokenize(line, tokens, " \t\n\r\f/"); 89 99 100 PRINTF(0)("size = %i, line = |%s|\n", read, line.c_str()); 101 90 102 while( !tokens.empty()) 91 103 { 92 PRINTF(0)("tokens: %s\n", tokens.back() );104 PRINTF(0)("tokens: %s\n", tokens.back().c_str()); 93 105 tokens.pop_back(); 94 106 } … … 96 108 } 97 109 } 98 this->dataStream.getline(buffer, 1024, '\n');99 std::string line(buffer);100 110 } 101 111 /*
Note: See TracChangeset
for help on using the changeset viewer.