#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/fgstream.hxx>
+#include <simgear/misc/sgstream.hxx>
#include STL_STRING
#include STL_FUNCTIONAL
airports.erase( airports.begin(), airports.end() );
- fg_gzifstream in( file );
+ sg_gzifstream in( file );
if ( !in.is_open() ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << file );
exit(-1);
+ } else {
+ SG_LOG( SG_GENERAL, SG_ALERT, "opened: " << file );
}
// skip first line of file
- char tmp[256];
- in.getline( tmp, 256 );
-
+ char tmp[2048];
+ in.getline( tmp, 2048 );
// read in each line of the file
while ( in.get(c) && c != '\0' ) {
if ( c == 'A' ) {
in >> a;
+ SG_LOG( SG_GENERAL, SG_INFO, a.id );
in >> skipeol;
airports.insert(a);
} else if ( c == 'R' ) {
#else
in >> ::skipws;
+ string token;
while ( ! in.eof() ) {
- char c = 0;
- in.get(c);
- if ( c == 'A' ) {
+ in >> token;
+ if ( token == "A" ) {
in >> a;
- cout << "in <- " << a.id << endl;
+ SG_LOG( SG_GENERAL, SG_INFO, "in <- " << a.id );
in >> skipeol;
airports.insert(a);
- } else if ( c == 'R' ) {
+ } else if ( token == "R" ) {
in >> skipeol;
} else {
in >> skipeol;