File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes writing a newline char into a text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "writing a newline char into a text file" Watch "writing a newline char into a text file" New topic
Author

writing a newline char into a text file

samuel higgins
Greenhorn

Joined: Apr 21, 2003
Posts: 1
using the FileWriter class, how to you write a newline into a text file? I tried \n but in the text file i just get a little black box.
thanks.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Wrap the FileWriter in a BufferedWriter and use the newLine() method. Something like this:

[ April 21, 2003: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi samuel
I have another method/suggestion to reference

I hope that I can answer your question
if you want to append the text to the text file
please post a message again


Francis Siu
SCJP, MCDBA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: writing a newline char into a text file