delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/09/13/07:34:08

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: Barry Kelly <bkelly DOT ie AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: java vs c, escape sequences
Date: Sat, 13 Sep 2008 12:33:10 +0100
Message-ID: <139nc45vrjhi6pdpb4333ijm7sj74alkuh@4ax.com>
References: <19469048 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <19469048.post@talk.nabble.com>
X-Mailer: Forte Agent 4.2/32.1117
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m8DBY6Sl011738

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019