*Edit as I cannot use anything other than Scanner class.
I'm reading in a text file for a Conway's Game of Life program that looks like so:
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
-------------X-X-X------------
--------------XXX-------------
-------------X-X-X------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
------------------------------
I am trying to read all the characters into a single string variable and then parsing the string into a char array. How would I fix my code for the FileReader to read all the lines, and not stop after reaching the end of one?
inputfile = JOptionPane.showInputDialog ("Where is the input file? Ex: C:\\users\\public\\desktop\\input.txt ");
Scanner input = new Scanner (new FileReader(inputfile));
String values = null;
while(input.hasNextLine()){
values = input.next();
}
System.out.println(values);