Need a solution to read and store data from a file
posted 9 years ago
Hii everyone..I an new to this forum, I have registered today. I want to know how to store the input values which are read from a file. The input values are all double values in a line separated by spaces. I want to read these values one after the other and store in a double typed variable.
For example: The input file name is input.txt. Let the first line of input text file is: 1.0,1.0,90.0 and second line: 1.0,1.0,0.0 and third line and so on
First I want to read the first line and then I want to store them like double a=1.0; double b=1.0; double c=90.0; and then go for the second line and read the data and store them and so on....
So, have you tried something? What problems did you face in doing this? Just to get you started, have a look at BufferedReader class. If you are the one writing the data also then you can use DataOutputStream and DataInputStream for writing and reading, that will make your life simple.