fred rosenberger wrote:the simplest debugging techniques are often the best. Try printing out the lines as you read them - i.e. make sure it is reading every line, not skipping any, etc. Try it on a smaller file - if you have a file with 20 lines, does it only read 5? Does it read the first five, the last five, every fourth one, etc.
You need to know what it is REALLY doing before you try and figure out WHY it is doing it.
fred rosenberger wrote:Ok...a few other things to try...
did using a smaller file help? I.e. take only the first 100 lines from your current file and process them.
Take the 50 lines before and the 50 after...it is possible there is some funky non-printing character in your file. I would literally copy it, then edit it with notepad or something similar, and cut out the first 11,350ish lines, and then the last <however many> lines.
Is it possible to regenerate the source file? maybe something bad happened when you created/copied/moved it.
It is hard to say without actually running the code and looking at the data file, and posting an 11k line file here is probably not going to help anyone...
Ed Dablin wrote:
First of all, the program always quit on the line which contained airport identifier "BGUK".
I then deleted the last 332 airports.
airportsTest5.csv of size 2 kB and 10 airports. Program DID NOT TERMINATE EARLY when count=9 (corresponding to 10 lines).
SO, IN THE FINAL CASE THE PROGRAM SUCCEEDED IN GETTING PAST THE "BGUK" LINE.
Could it be there is some weird character in the last 340 (or so) lines of airportsTest4.csv ??
What weird character could bring the program to an early stop?
Ed Dablin wrote:I've gone back to the source of the data and it is UTF-8.
Whatever that means!
I will read up about character encodings - a subject on which I confess total ignorance
Campbell Ritchie wrote:Control characters like ctrl-D or ctrl-Z which are not in the original text cannot therefore appear mysteriously when you encode it in UTF‑8.
Ed Dablin wrote:It works! Now I get all 44,674 airports.
I changed my Scanner parameters as follows:
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton