From: rrd AT ftc DOT agilent DOT com (Ray Depew) Newsgroups: comp.os.msdos.djgpp Subject: DOS cursor/screen commands? Date: Fri, 15 Nov 2002 17:18:10 +0000 (UTC) Organization: Agilent Technologies Lines: 38 Message-ID: <1037380690.391305@cswreg.cos.agilent.com> NNTP-Posting-Host: cswreg.cos.agilent.com X-Trace: cswtrans.cos.agilent.com 1037380690 3314 130.29.154.45 (15 Nov 2002 17:18:10 GMT) X-Complaints-To: usenet AT cswtrans DOT cos DOT agilent DOT com NNTP-Posting-Date: Fri, 15 Nov 2002 17:18:10 +0000 (UTC) X-Newsreader: TIN [version 1.2 PL2.11] Cache-Post-Path: cswreg.cos.agilent.com!unknown AT icbdxts2 DOT ftc DOT agilent DOT com X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I'm trying to do the equivalent of DOS "cls" in a C program. When I run the following program, all I get on stdout is the following three lines. Hello *[2J Goodbye What I've shown as an asterisk is a "left-arrow" character representing the escape character. What am I doing wrong? And is there a better way to do it? /* file 'clrscrn.c' */ /* Ray Depew 14 Nov 2002 11:00 */ /* An attempt to clear the screen under program command. */ /* 'Clear screen' for MSDOS is defined as ESC[2J, * where ESC is the escape character, ASCII 27, * and 2 can be any integer or omitted completely, * according to * */ int main() { printf("Hello\n"); printf("\033[2J"); /* this is the "clear screen" escape sequence */ printf("Goodbye\n"); return 0; } -- Regards | C++ is like a Swiss Army knife with a chainsaw Ray Depew | attachment. You can program most anyway you want, | but it's really, really easy to cut your leg off. ray_depew AT agilent DOT com | -- Alex Pavloff explains C++ on comp.arch.embedded