Writing into a file without printing "\n" in seperate lines
posted 10 years ago
Hello Friends, I am facing an issue that while writing to the file i am able to print "\n" for getting all the files in seperate line.But i want to avoid this i.e. i want to write in separate line but "\n" shouldnt be printed. I am using bf.newLine() for the separate lines... How can i avoid this?
I don't know what you mean by "bf.newLine()". Is "bf" a variable in your program? If so, what's the type?
Different operating systems use different sequences of characters to represent newlines in text files. For example, Windows uses a sequence of two characters: carriage return and line feed (ASCII codes 10 and 13). Unix computers use just one character: line feed.
In Java, if you want to write a program that uses the line ending sequence of the operating system you're running it on, you should get the system property named "line.separator" instead of directly putting codes line "\n" in the program.