Try adding '\r\n' instead of just '\n' The '\n' specifies a new line
but you need to specify a carriage return by putting '\r' first. That
should make the line split into two as you desire.
Good luck!
> I want to write a String type to a local file
> the code like:
[quoted text clipped - 21 lines]
> thank you
> ^_^
> I want to make a new line in the dest.txt
> just like:
[quoted text clipped - 4 lines]
> what should I add to the String src
> a char '\n' ??
The line seperation String (not nescessarily a single character) is
platform dependent. You can query it using System.getProperties:
http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()
- Oliver
Tajonis - 21 Jul 2006 16:04 GMT
> The line seperation String (not nescessarily a single character) is
> platform dependent. You can query it using System.getProperties:
> http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()
to elaborate and to make it even easier you could use this
String str = "xxxxxxxxx" + System.getProperty("line.separator");
this should provide the ability to determine which line terminator to
use for each platform that your application runs on.
Steve W. Jackson - 21 Jul 2006 16:18 GMT
> > I want to make a new line in the dest.txt
> > just like:
[quoted text clipped - 10 lines]
>
> - Oliver
And I have to wonder why the OP doesn't use a PrintWriter instead, so
that this is a non-issue.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
jtl.zheng - 21 Jul 2006 17:13 GMT
haha
Thank you very much
the "\r\n" and System.getProperty("line.separator") are both OK
^_^
Andrew Thompson - 22 Jul 2006 01:25 GMT
...
> the "\r\n" and System.getProperty("line.separator") are both OK
But while "\n\r" is fragile, System.getProperty("line.separator")
should work X-plat, now and in the future.
Andrew T.
jtl.zheng - 22 Jul 2006 02:37 GMT
yes...so I am using System.getProperty("line.separator") now
thanks
: )