Removing null value line in “.dat” file when using PrintWriter
-
14-11-2019 - |
Question
Anyone know how to remove null value line in ".dat" file when I create file using PrintWriter
?
Why does the file just print a null line in the last page of line, I already put:
PrintWriter outputFile = new PrintWriter(new FileWriter(File file));
then after I do process .. I put:
outputFile.flush();
outputFile.close();
But null is still printing on the last line. When I try to save the file in .txt format, there is no null line. but I need to save as a ".Dat" file.
Solution
Suffix doesn't matter for a file, so there should be no difference between these two files. The null value you saw in .Dat file is maybe a place-holder for editor that you opened the file with.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow