Whenever using the 'writeBytes' method of RandomAccessFile
in java,it writes the text in the same line in the file. How can I get to a new line with RandomAccessFile
only? (No BufferedReader
).
You can write a line separator. In order to get the correct line separator for the currently running operating system, you'll have to look for the line.separator
property. Something along these lines:
randomAccessFile.writeBytes(System.getProperty("line.separator"));