Results 1 to 4 of 4
Thread: Reading from file to array error
- 12-08-2011, 11:11 AM #1
Member
- Join Date
- Dec 2011
- Posts
- 16
- Rep Power
- 0
- 12-08-2011, 11:54 AM #2
Member
- Join Date
- Dec 2011
- Posts
- 16
- Rep Power
- 0
Re: Reading from file to array error
I manage to fix the problem, but now I get another problem.
in the system output it says that the problem starts there:Java Code:BufferedReader br = new BufferedReader(new FileReader(filename)); for(int t = 0; t < 20;t++) { array[t] = br.readLine(); } for(int i = 0; i < array.length; i++) { if(array[i] != null) { System.out.println(array[i]); } } String[][]tempArray = new String[array.length][]; for(int t = 0; t < array.length;t++) { tempArray[t] = array[t].split(";"); } String[] iArray = new String[tempArray.length]; String[] tArray = new String[tempArray.length]; for(int i = 0; i < tempArray.length; i++) { iArray[i] = tempArray[i][0]; tArray[i] = tempArray[i][1]; }
tempArray[t] = array[t].split(";");
- 12-08-2011, 12:26 PM #3
Member
- Join Date
- Nov 2011
- Posts
- 24
- Rep Power
- 0
Re: Reading from file to array error
I'm guessing that you didn't initialize the tempArray properly.
- 12-08-2011, 01:13 PM #4
Member
- Join Date
- Oct 2011
- Posts
- 90
- Rep Power
- 0
Similar Threads
-
Reading a .txt file into an array
By nifa98 in forum New To JavaReplies: 4Last Post: 11-28-2011, 07:04 AM -
Reading a file into an array?
By heycoa in forum New To JavaReplies: 4Last Post: 07-07-2011, 04:22 AM -
Help with reading file into array
By xkillswitchx14 in forum New To JavaReplies: 2Last Post: 04-28-2011, 10:24 PM -
Help with reading from file into an array
By Trad in forum New To JavaReplies: 3Last Post: 10-22-2010, 12:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks