FileWriter writer = new FileWriter(taskFile, true);
writer.write(format);
writer.write(format);//I expect this words appear in newline in my
file but I am frustrated who can
// tell me why .thanks in advance.
>
They should be new lines.
Since you use Writer they are localized to your local system.
It's possible that you read in tool which is set for another
localization. Simplest example would be if you write file for UNIX
system and try to read it in Windows. Or Mac vs UNIX or whatever.
Look inside your file character by character and you should understand
what's going on.
writer.println(format);
Well, you haven't show us any newlines here. Does "task" have one? If
not then you have to add one.
Jeff had the best answer, use println from the PrintWriter class.
If you cannot for some reason, then you'll have to add the newlines
manually. Use System.getProperty("line.separator") to get the correct
newline for your system in that case.
> FileWriter writer = new FileWriter(taskFile, true);
>
> writer.write(format);
> writer.write(format);//I expect this words appear in newline in my
>file but I am frustrated who can
> // tell me why .thanks in advance.
see http://mindprod.com/applet/fileio.html
to generate you some code. You will need a PrintWriter.println() to
get the newlines right for your platform.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
>you are so great. I fell so great . i use
>System.setProperty("line.separator","\r\n");and it works .thank you
>very mush.
You don't need to do that. The line.separator property is already set
for you to the platform default.