File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing into a file without printing "\n" in seperate lines

 
Monish Das
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic