-// save the data in gdbm format
-bool FGAirportsUtil::dump_gdbm( const string& file ) {
-
- GDBM_FILE dbf;
-
-#if defined( MACOS ) || defined( _MSC_VER )
- dbf = gdbm_open( (char *)file.c_str(), 0, GDBM_NEWDB | GDBM_FAST,
- NULL, NULL );
-#else
- dbf = gdbm_open( (char *)file.c_str(), 0, GDBM_NEWDB | GDBM_FAST,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
- NULL );
-#endif
-
- if ( dbf == NULL ) {
- cout << "Error opening " << file << endl;
- exit(-1);
- } else {
- cout << "successfully opened " << file << endl;
- }
-
- iterator current = airports.begin();
- const_iterator end = airports.end();
- while ( current != end ) {
- datum key;
- key.dptr = (char *)current->id.c_str();
- key.dsize = current->id.length();
-
- datum content;
- FGAirport tmp = *current;
- content.dptr = (char *)(& tmp);
- content.dsize = sizeof( *current );
-
- gdbm_store( dbf, key, content, GDBM_REPLACE );
-
- ++current;
- }
-
- gdbm_close( dbf );
-
- return true;