Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing in a text File is appending some SPECIAL Symbol on using any StringBuffer with \n  RSS feed

 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I am using this piece of code to write some Strings in a Text File , but on using the newLine() , it is adding some INVALID Charatcters
nation[#]patry[#^]like

It is not appending the text to the next line , and in the same line replacing the next line with some unknown charaters.
I am appending the values in stringBuffer with a next line("\n") after each string.

THIS SCENARIO IS COIMING IN FEW SYSTEMS. IN SOME SYSTEM IT IS WORKING FINE BUT IN SOME IT IS RASING


 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The end of line character is platform-specific. '\n' (0x0A) is the end-of-line character for Unix systems. Windows systems use "\r\n" (0x0D 0x0A). Java methods like BufferedWriter.newLine() and System.getProperty("line.separator") are provided to utilize or obtain the current system's end-of-line character.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!