I am trying to read some numerical values from a file and getting this error:
Input Error: Error in input: Floating point number not found.; Expecting Real number in the range -1.7976931348623157E308 to 1.7976931348623157E308
[code=java]
import java.io.*;
public class TriangleMain {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
TextReader data;
//String name;
double x1,y1,x2,y2,x3,y3;
try
{ // Create the input stream.
data = new TextReader(new FileReader("points.txt"));
}
catch (FileNotFoundException e) {
System.out.println("Can't find file points.txt!");
return; // End the program by returning from main().
}
try {
// Read numbers from the input file and print them out
while ( data.eof() == false ) { // Read until end-of-file.
//name=data.getWord();
x1 = data.getDouble();
y1 = data.getDouble();
x2 = data.getDouble();
y2 = data.getlnDouble();
x3 = data.getlnDouble();
y3 = data.getlnDouble();
System.out.println("The end points are ("+x1+", "+y1+") and ("+x2+", "+y2+")");//) and ("+x3+", "+ y3+")");
}
}
catch (IOException e) {
// Some problem reading the data from the input file.
System.out.println("Input Error: " + e.getMessage());
}
}
}
txt file is attached with this thread.