Mark Space أرسلت:
> > In netbeans 5.0, carriage return results e.g:
> >
[quoted text clipped - 6 lines]
>
> Looks ok to me. What were you expecting?
\r means carriage return not new line
so, the result must be
to java
the cursor will return to the start of current line
another e.g:
System.out.print("Welcome \rjava");
the output:
javaome
but in netbeans 5.0 the output is:
Welcome
java
????
like \n?
????
Oliver Wong - 13 Mar 2007 20:16 GMT
>Mark Space ÃÑÓáÊ:
>> > In netbeans 5.0, carriage return results e.g:
[quoted text clipped - 32 lines]
>
>????
I suspect the issue is not with NetBeans, but rather with whatever
program (probably some sort of shell, like cmd or bash, or perhaps
NetBean's integrated console) is interpreting the data sent via standard
out.
I'm surprised you know enough to know the "original" meaning of \r,
and yet never experienced the behaviour of treating \n and \r as both a
carriage return followed by a newline until now. Have you been
cryogenically frozen or something?
- Oliver
Andreas Leitgeb - 13 Mar 2007 20:48 GMT
> System.out.print("Welcome \rjava");
> the output:
> javaome
> but in netbeans 5.0 the output is:
> Welcome
> java
The problem is not, what gets written out to System.out,
but rather how much effort netbeans does to emulate a
real terminal. Obviously this effort does not go far
enough to distinguish between \r and \n.
I just tried with netbeans 5.5: same result.
Then I run the same .jar file from a real
terminal, and I see the expected "javaome".
If you replace the \r with a few \b's, you'll see
that netbeans doesn't even handle backspaces as
such, but instead writes them as white rectangles.
Lara - 14 Mar 2007 18:19 GMT
I tried netbeans 3.5
the result : javaome
so , it's ok with netbeans 3.5
but netbeans 5.0 , \r dose not do its work...????!!!!!
Karl Uppiano - 15 Mar 2007 03:04 GMT
>> System.out.print("Welcome \rjava");
>> the output:
[quoted text clipped - 7 lines]
> real terminal. Obviously this effort does not go far
> enough to distinguish between \r and \n.
I'm guessing NetBeans simply uses one of the Swing text controls for its
console output, and it does not emulate a real console at all. I have
noticed that it handles Unicode better than a "real" console, too. I don't
think they really intended it to be a high-fidelity console.