Results 1 to 4 of 4
- 04-09-2012, 09:21 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 18
- Rep Power
- 0
read text data and store to array
hi ,
i am currently doing a program which it can read the data in the text file and store it to the array
this is what i have done so far :
import java.io.*;
import java.util.*;
class FileRead
{
public static void main(String args[])
{
try{
FileInputStream fstream = new FileInputStream("Data.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
System.out.println (strLine);
}
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
can anyone guild me how to improve that ???
thanks in advance :)
- 04-09-2012, 09:26 AM #2
Member
- Join Date
- Mar 2012
- Posts
- 18
- Rep Power
- 0
Re: read text data and store to array
i will have a Data.txt like this :
2
192.168.1.1 ; pc1 ; /home/pc1/Desktop ; C:/home/Documents
192.168.1.2 ; pc2 ; /home/pc2/Desktop ; C:/home/Documents
the 2 is to make a array size of 2 and store the certain info into the array that i want .
- 04-09-2012, 02:40 PM #3
Re: read text data and store to array
Can you explain what your problems are?
If you don't understand my response, don't ignore it, ask a question.
- 04-09-2012, 03:07 PM #4
Similar Threads
-
Read in File and Store it in an Array. Please Help!
By PurpleDemon666 in forum New To JavaReplies: 1Last Post: 10-21-2011, 09:50 PM -
Read xml data with multiple attributes and store values
By LiveStrong-2011 in forum New To JavaReplies: 4Last Post: 06-08-2011, 01:45 AM -
Store links in text file and read into variables
By africanhacker in forum New To JavaReplies: 1Last Post: 03-31-2011, 06:18 PM -
Need a solution to read and store data from a file
By sheetalnri in forum New To JavaReplies: 10Last Post: 09-30-2010, 07:43 AM -
How to read data from excel and store it in db
By saran123 in forum New To JavaReplies: 5Last Post: 10-03-2008, 11:19 AM
Bookmarks