Hi guys.
I have created a program which takes a text file full of 3 letter words and processes them, stores them in an array and then outputs to the build output in JCreator and then writes the same output to a file.
Now, this program works fine, but when I print a lot of data - I get all of these blank lines inserted where there shouldn't be any.
I use this to print to my file:
PrintWriter fw = new PrintWriter(new FileWriter("Dictionary.txt"));
for (int i=0; i<count; i++)
{
if (words[i]!=null)
fw.println(words[i]);
}
I loop through the array and don't print to a file, just to my output screen on the IDE. Now, I will suddenly get a blank line where there shouldn't be, like so:
tut
tuxuke
use
and it seems to be completely random.
Now how would I remove these lines from the file without having to write to a new file, as writing large amounts of lines seems to cause this problem.
Thanks guys