This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: java vs c, escape sequences
- From: Barry Kelly <bkelly dot ie at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Sat, 13 Sep 2008 12:33:10 +0100
- Subject: Re: java vs c, escape sequences
- References: <19469048.post@talk.nabble.com>
rick271828 wrote:
> Can anybody please explain why the c code:
> printf("%c[H%c[J",27,27); clears my cygwin console as expected, but the
> Java code:
>
> System.out.print("\033[2J\033[H");
>
> displays a back arrow instead on interpreting the escape character?
It's because you are not running the program with stdout attached to a
terminal or terminal emulator. Probably, you are running in a console
window.
Cygwin can emulate a terminal in a console window for programs that do
all I/O through it, but for third-party applications, like Sun java, it
cannot.
Run the application in rxvt and it works as expected.
-- Barry
--
http://barrkel.blogspot.com/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/