Results 1 to 2 of 2
Thread: reading from a .txt
- 09-14-2009, 01:19 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 1
- Rep Power
- 0
reading from a .txt
i have a file that has two digits at top showing the size of the array then the array.
example
what i want to do is read in the two numbers at top then declare a 2d array of that size and read in each number into its appropriate spot in the 2d array.Java Code:04 04 01 01 01 01 11 11 11 11 04 04 04 04 23 23 23 23
my question is why does reading in the line show the right numbers but when i try to read in the numbers individually i always get random numbers?
good-
bad-Java Code:FileReader aFile=new FileReader("Array.txt"); BufferedReader fReader = new BufferedReader(aFile); for(int i=0;i<2;i++) System.out.println(mReader.readLine()); MapFile.close();
Java Code:FileReader aFile=new FileReader("Array.txt"); BufferedReader fReader = new BufferedReader(aFile); for(int i=0;i<2;i++) System.out.println(mReader.read()); MapFile.close();
- 09-14-2009, 08:35 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
problem with reading excel sheet data reading using poi libraries
By sandeepsai17 in forum New To JavaReplies: 5Last Post: 08-21-2009, 11:03 AM -
Array not reading. Plz help
By cmizer in forum New To JavaReplies: 14Last Post: 02-12-2009, 12:02 AM -
Reading cookies in JSP
By Java Tip in forum Java TipReplies: 0Last Post: 01-15-2008, 03:12 PM -
Reading a file
By mew in forum New To JavaReplies: 2Last Post: 12-30-2007, 12:23 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks