LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2003, 04:21 PM   #16
coldfusion
LQ Newbie
 
Registered: Nov 2003
Distribution: Slackware 9 / kernel 2.6-test9
Posts: 8

Rep: Reputation: 0

Code:
printf("%c%c%c%c%c%c",27,'[','H',27,'[','J' );

i think an easier way than this (but essentially the same thing) is:


Code:
printf("\e[H\e[J");

but, to each his own.

Last edited by coldfusion; 11-22-2003 at 04:22 PM.
 
Old 11-23-2003, 11:58 PM   #17
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
this works beacuse these are terminal escape sequences....

if you were to do a clear > myclearfile
and try to more that file...
you'd see these characers...
the moment this string appears on the terminal...anywhere...
the terminal is cleared...
 
Old 11-24-2003, 09:07 AM   #18
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
Superficially it works b/c it is defined by an ANSI standard.
There are other escape sequences defined that perform
other useful operations. They all work on terminals that are
ANSI compliant like DOS (if you have ansi.sys) and linux. The
real "why" of it working changes from platform to platform
mostly at a hardware level.

See:
http://astronomy.swin.edu.au/~pbourk...mats/ansi.html
 
Old 11-24-2003, 07:27 PM   #19
Avatar33
Member
 
Registered: May 2003
Location: South Africa
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
Talking Thanks

Aaaah I See. Thanks a lot. I wish all messages answered the "why". It helps in many situations to know why. Thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i replace the clear "clear screen" with the cls command thefedexguy SUSE / openSUSE 2 12-02-2005 05:02 PM
how to clear screen in C ? indian Programming 3 10-01-2004 10:58 PM
chroot not able to clear screen Archite Linux - Security 6 07-13-2004 10:41 AM
Clear the Screen in C++ OrganicX Programming 16 07-23-2003 04:07 PM
How to clear screen? alexzander Programming 1 01-23-2003 08:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration