This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java vs c, escape sequences


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]