Fix crash when providing bad command line argument
[clinton/bobotpp.git] / source / String.C
index 8d6e5eb..05acdff 100644 (file)
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #include "String.H"
-#include "Utils.H"
 
-#include <cstring>
-#include <cctype>
 #include <sstream>
 #include <iostream>
 
+#include <cstdlib>
+#include <cstring>
+#include <cctype>
+
+#include "Utils.H"
+
 String::String()
 {
 }
@@ -189,7 +192,7 @@ String::operator[](int i_) const
 
   if (i < 0 || my_string.length () < i) {
     std::cerr << "String index out of range\n";
-    exit(1);
+    std::exit(1);
   }
   return my_string[i];
 }
@@ -289,10 +292,11 @@ String::operator+(const std::string & s)
   return my_string + s;
 }
 
-String::operator const char *() const
-{
-  return my_string.c_str ();
-}
+const char*
+String::c_str () const
+ {
+   return my_string.c_str ();
+ }
 
 String::operator std::string () const
 {