Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need a solution to read and store data from a file  RSS feed

 
Sheetal Malhotra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....

Thanks and Regards,
-Sheetal-
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!