Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: Ryan Marcus on October 04, 2005, 09:13:59 AM

Title: [Java] PrintWriter println question
Post by: Ryan Marcus on October 04, 2005, 09:13:59 AM
I have named a PrintWriter pOut...

If I do this:

pOut.println("Test");


Will it print Test, Test + chr(13), Test + chr(10), or Test + chr(13) + chr(10)?
Title: Re: [Java] PrintWriter println question
Post by: Tuberload on October 04, 2005, 02:00:14 PM
To be technical it will print "Test\n" which equates to string: Test + New Line(Line Feed).

Java is a cross platform language so the New Line literal is dependent upon the platform it is being executed on.
Title: Re: [Java] PrintWriter println question
Post by: Ryan Marcus on October 04, 2005, 05:41:34 PM
Ok, so just to make sure:

Mac: chr(13)
Linux: chr(10)
PC: chr(13) + chr(10)

Right?
Title: Re: [Java] PrintWriter println question
Post by: Tuberload on October 04, 2005, 08:18:16 PM
Quote from: Ryan Marcus on October 04, 2005, 05:41:34 PM
Ok, so just to make sure:

Mac: chr(13)
Linux: chr(10)
PC: chr(13) + chr(10)

Right?

Why do you need to know this? If you are trying to detect the new lines you can just compare it to it's character literal '\n'.

I believe you are correct, though I do not know what they are for Mac or *nix.