Changeset 4084 in orxonox.OLD for orxonox/trunk/src/lib/util/ini_parser.cc
- Timestamp:
- May 6, 2005, 4:04:57 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/util/ini_parser.cc
r4028 r4084 16 16 17 17 #include "ini_parser.h" 18 #include "resource_manager.h" 18 19 19 20 using namespace std; 20 21 21 22 /** 22 23 23 \brief constructs an IniParser using a file 24 \param filename: the path and name of the file to parse 24 25 */ 25 26 IniParser::IniParser (const char* filename) … … 31 32 32 33 /** 33 34 \brief removes the IniParser from memory 34 35 */ 35 36 IniParser::~IniParser () … … 45 46 int IniParser::openFile(const char* filename) 46 47 { 48 char* tmpName = ResourceManager::homeDirCheck(filename); 47 49 if( filename == NULL) return -1; 48 50 if( stream != NULL) fclose (stream); 49 if( (stream = fopen ( filename, "r")) == NULL)51 if( (stream = fopen (tmpName, "r")) == NULL) 50 52 { 51 printf("IniParser could not open %s\n", filename); 53 PRINTF(1)("IniParser could not open %s\n", filename); 54 delete tmpName; 52 55 return -1; 53 56 } 54 57 bInSection = false; 58 delete tmpName; 55 59 return 0; 56 60 } … … 123 127 return -1; 124 128 } 125 if( (ptr = strchr( linebuffer, '=')) != NULL) 129 sscanf(linebuffer, "%s = %s", name, value); 130 return 0; 131 /* 132 if( (ptr = strchr( tmpBuffer, '=')) != NULL) 126 133 { 127 if( ptr == linebuffer) continue; 128 strcpy (value, &ptr[1]); 129 strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1); 130 return 0; 134 if( ptr == linebuffer) continue; 135 strcpy (value, &ptr[1]); 136 strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1); 137 printf ("%s, %s\n", value, name); 138 return 0; 131 139 } 140 */ 132 141 } 133 142 return -1;
Note: See TracChangeset
for help on using the changeset viewer.