I have found some code which i think will read the text file. This was found on a website i think i might be able to modify this and use it in my code.
- import java.io.*;
-
-
public class ReadFile{
-
public static void main(String[] args){
-
try {
-
-
/* Sets up a file reader to read the file passed on the command
-
line one character at a time */
-
FileReader input = new FileReader(args[0]);
-
-
/* Filter FileReader through a Buffered read to read a line at a
-
time */
-
BufferedReader bufRead = new BufferedReader(input);
-
-
String line; // String that holds current file line
-
int count = 0; // Line number of count
-
-
// Read first line
-
line = bufRead.readLine();
-
count++;
-
-
// Read through file one line at time. Print line # and line
-
while (line != null){
-
System.out.println(count+": "+line);
-
line = bufRead.readLine();
-
count++;
-
}
-
-
bufRead.close();
-
-
-
-
}catch (IOException c){
-
// If another exception is generated, print a stack trace
-
c.printStackTrace();
-
}
-
-
}// end main
-
}
It will allow me to read a text file and it will display the results on screen :D
I have also bought a book which should hopefully help.
i might be posting back on here later though.
Thanks
Arch