Changeset f75030 for molecuilder/src/config.cpp
- Timestamp:
- May 23, 2008, 9:17:19 AM (17 years ago)
- Children:
- 6145aa7
- Parents:
- 6c96f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified molecuilder/src/config.cpp ¶
r6c96f4 rf75030 282 282 case 'j': // BoxLength 283 283 cout << Verbose(0) << "enter lower triadiagonalo form of basis matrix" << endl << endl; 284 for (int i= 0;i<6;i++) {284 for (int i=6;i--;) { 285 285 cout << Verbose(0) << "Cell size" << i << ": "; 286 286 cin >> mol->cell_size[i]; … … 408 408 409 409 /** Retrieves the path in the given config file name. 410 * \param *filename config file string410 * \param filename config file string 411 411 */ 412 void config::RetrieveConfigPathAndName( char *filename)412 void config::RetrieveConfigPathAndName(string filename) 413 413 { 414 414 char *ptr = NULL; 415 char *buffer = new char[MAXSTRINGSIZE]; 416 strncpy(buffer, filename.c_str(), MAXSTRINGSIZE); 415 417 int last = -1; 416 for(int i=0;i<MAXSTRINGSIZE;i++) { 417 if (filename[i] == '/') 418 last = i; 419 if (filename[i] == '\0') 418 for(last=MAXSTRINGSIZE;last--;) { 419 if (buffer[last] == '/') 420 420 break; 421 421 } 422 if (last == -1) { // no path in front, set to local directory.422 if (last == 0) { // no path in front, set to local directory. 423 423 strcpy(configpath, "./"); 424 ptr = filename;424 ptr = buffer; 425 425 } else { 426 strncpy(configpath, filename, last+1);427 ptr = & filename[last+1];426 strncpy(configpath, buffer, last+1); 427 ptr = &buffer[last+1]; 428 428 if (last < 254) 429 429 configpath[last+1]='\0'; … … 431 431 strcpy(configname, ptr); 432 432 cout << "Found configpath: " << configpath << ", dir slash was found at " << last << ", config name is " << configname << "." << endl; 433 delete[](buffer); 433 434 }; 434 435 … … 824 825 825 826 826 for (i=0;i<128;i++) elementhash[i] = NULL; 827 for (i=MAX_ELEMENTS;i--;) 828 elementhash[i] = NULL; 827 829 cout << Verbose(0) << "Parsing Ions ..." << endl; 828 830 No=0;
Note:
See TracChangeset
for help on using the changeset viewer.