fix reading of doubles. There may be a + after the e

This commit is contained in:
Andreas Fabri 2015-04-20 17:58:42 +02:00
parent 4db540c6c8
commit b1c417e7b7
3 changed files with 19 additions and 1 deletions

View File

@ -132,7 +132,7 @@ public:
break; break;
} }
c = static_cast<char_type>(i); c = static_cast<char_type>(i);
if(std::isdigit(c) || (c =='.') || (c =='E') || (c =='e') || (c =='-')){ if(std::isdigit(c) || (c =='.') || (c =='E') || (c =='e') || (c =='+') || (c =='-')){
buffer += c; buffer += c;
}else{ }else{
is.unget(); is.unget();

View File

@ -0,0 +1,4 @@
+1.2e+3 45 12
+1.2e03 45 12
+1.2e003 45 12
-1.2e03 45 12

View File

@ -0,0 +1,14 @@
#include <iostream>
#include <fstream>
#include <CGAL/Simple_cartesian.h>
int main()
{
std::ifstream in("data/double.txt");
CGAL::Simple_cartesian<double>::Point_3 p;
while(in >> p){
std::cout << p << std::endl;
}
return 0;
}