I am writing a master program for my simulator. I get briefings in a .txt file, and I'm trying to read a file with a scanner. The .txt file contains a power symbol, and this causes the scanner to read not the entire file.
public static String[] ConvertFile(String FileName){
ArrayList<String> FileArray = new ArrayList<String>();
int count = 0;
try{
Scanner file = new Scanner( new File ("C:\ <File Location>" + FileName));
while(file.hasNextLine()){
count++;
String Line = file.nextLine());
System.out.printf("%3d: %s %n", count, Line );
System.out.println(count);
}
}
catch(FileNotFoundException fnfe){
System.out.println("File Not Found.");
}
return null;
}
Ive put a line in the question below (line 23)
COND: 140475 LB
Note that the output prints the first 16 lines of the txt file when there are 726 lines. I know its degree symbol because when I edit txt and delete degree symbols, the program displays all the lines.
source
share