[Logo] JavaRanch » Big Moose Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » I/O and Streams
 
RSS feed
 
New topic
Author

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

buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Messages: 50



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

Joined: Oct 29, 2001
Messages: 6879

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.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » I/O and Streams
 
RSS feed
 
New topic
JProfiler
Get rid of your performance problems and memory leaks!