How can this clear the screen?

This is a discussion on How can this clear the screen? within the C Programming forums, part of the General Programming Boards category; Code: printf("\e[H\e[2J"); I'm amazed Can someone explain how can this clear the screen in details please?...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    204

    How can this clear the screen?

    Code:
    printf("\e[H\e[2J");
    I'm amazed

    Can someone explain how can this clear the screen in details please?

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    Because the terminal you're using understands ANSI escape codes:
    http://www.bluesock.org/~willg/dev/ansi.html
    If you understand what you're doing, you're not learning anything.

  3. #3
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    Cursor Home

    Code:
    \e[{ROW};{COLUMN}H
    
    \e[H
    Sets the cursor position where subsequent text will begin. If no row/column parameters are provided (ie. \e[H), the cursor will move to the home position, at the upper left of the screen.


    Erase Screen

    Code:
    \e[2J
    Erases the screen with the background colour and moves the cursor to home.

    I found that here.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You must have never played any old DOS text / ANSI games or MUDs. Kids these days.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CLear Screen Routine
    By AQWst in forum C++ Programming
    Replies: 4
    Last Post: 12-13-2004, 08:24 PM
  2. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 03:41 AM
  3. Getting a clear screen...
    By Finchie_88 in forum C++ Programming
    Replies: 13
    Last Post: 09-03-2004, 06:38 PM
  4. Clear Screen Again!!!
    By trang in forum C Programming
    Replies: 3
    Last Post: 12-13-2003, 08:36 AM
  5. Yet another clear screen thread :D
    By kermit in forum Linux Programming
    Replies: 2
    Last Post: 11-20-2003, 05:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21