From: "J." <mailing-lists@xs4all.nl>
To: linux-c <linux-c-programming@vger.kernel.org>
Subject: Re: clear the screen
Date: Mon, 21 Feb 2005 08:59:46 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.21.0502210854220.600-100000@hestia> (raw)
In-Reply-To: <1108969688.5088.12.camel@localhost.localdomain>
On Mon, 21 Feb 2005, kaushal wrote:
> hello all,
> Sorry for a very basic question.I would like to know how to clear the
> screen from within a c program without using system("clear") or any of
> the ncurses functions.Can we do this using printf?My program is in raw
> mode so is there any feature available by which I can use the termios
> structure for clearing the screen if it is not possible with printf.Long
> ago when I used work in the dos platform I used conio.h and clrscr()
> rourine.I guess I have to write that clrscr() routine's code itself.Im
> working on a linux machine now.
>
> Thanks in advance.
> -kaushal.
Don't know if this is of any help to you:
#include <stdio.h>
int main(void) {
printf("\e[0m\e[2J\e[1;1H");
return 0;
}
When the compiler is called with some warning flags it might complain
about a non-standard escape sequence, but it compiles fine and it works.
Goodluck & Regards,
J.
--
http://www.rdrs.net
next prev parent reply other threads:[~2005-02-21 7:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-21 7:08 clear the screen kaushal
2005-02-21 7:59 ` J. [this message]
2005-02-21 9:56 ` Vinodkumar Nair
2005-02-21 10:12 ` YYW
2005-02-21 13:50 ` Darren Sessions
2005-02-21 14:15 ` Ron Michael Khu
2005-02-23 0:16 ` Glynn Clements
2005-02-23 12:54 ` Progga
2005-02-28 6:36 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.21.0502210854220.600-100000@hestia \
--to=mailing-lists@xs4all.nl \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).