#include <stdio.h>
#include <stdlib.h> // atof(), atoi()
#include <string.h> // strcmp()
+#include <algorithm>
#include STL_STRING
SG_USING_STD(string);
+SG_USING_STD(sort);
SG_USING_NAMESPACE(std);
// Show available aircraft types
void fgShowAircraft(void) {
+ vector<string> aircraft;
+
SGPath path( globals->get_fg_root() );
path.append("Aircraft");
exit(-1);
}
- cout << "Available aircraft:" << endl;
while ((dire = ulReadDir(dirp)) != NULL) {
char *ptr;
snprintf(cstr, 96, " %-27s\n%32c%s", dire->d_name, ' ',
(desc) ? desc->getStringValue() : "" );
- cout << cstr << endl;
+ aircraft.push_back(cstr);
}
}
+ sort(aircraft.begin(), aircraft.end());
+ cout << "Available aircraft:" << endl;
+ for (int i = 0; i < aircraft.size(); i++)
+ cout << aircraft[i] << endl;
+
+ aircraft.clear();
ulCloseDir(dirp);
}