]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGConfigFile.cpp
Make yasim accept the launchbar and hook properties. They are not tied to anything...
[flightgear.git] / src / FDM / JSBSim / FGConfigFile.cpp
index a3bb234773072f35c0c77d566d57eb67cafab6f4..f994aba06c8549061514569f5c20ade262c274b1 100644 (file)
@@ -21,6 +21,8 @@ INCLUDES
 #include <stdlib.h>
 #include <math.h>
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_CONFIGFILE;
 
@@ -30,7 +32,7 @@ CLASS IMPLEMENTATION
 
 FGConfigFile::FGConfigFile(string cfgFileName)
 {
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
   cfgfile.open(cfgFileName.c_str(), ios::in );
 #else
   cfgfile.open(cfgFileName.c_str(), ios::in | ios::binary );
@@ -38,7 +40,7 @@ FGConfigFile::FGConfigFile(string cfgFileName)
   CommentsOn = false;
   CurrentIndex = 0;
   Opened = true;
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
    if (!cfgfile.fail() && !cfgfile.eof())  GetNextConfigLine();
 #else
   if (cfgfile.is_open()) GetNextConfigLine();
@@ -212,7 +214,7 @@ string FGConfigFile::GetLine(void)
       }
     } else {
       if ((test = cfgfile.get()) != EOF) { // get *next* character
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740) || defined (_MSC_VER)
         if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
 #else
         if (test >= 0x20 || test == 0x09) cfgfile.unget();
@@ -221,6 +223,12 @@ string FGConfigFile::GetLine(void)
       }
     }
   }
+
+  int index = scratch.find_last_not_of(" ");
+  if (index != string::npos && index < (scratch.size()-1)) {
+    scratch = scratch.substr(0,index+1);
+  }
+
   if (cfgfile.eof() && scratch.empty()) return string("EOF");
   return scratch;
 }
@@ -339,4 +347,4 @@ void FGConfigFile::Debug(int from)
     }
   }
 }
-
+}