Thread: clear console screen

  1. #1
    Registered User
    Join Date
    Jul 2022
    Posts
    51

    clear console screen

    anyone know the code to clear console screen

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,113
    Quote Originally Posted by WaterSerpentM View Post
    anyone know the code to clear console screen
    That would depend on the O/S. Please check this article for multiple O/S's.

    Also, you could use ncurses.
    Last edited by rstanley; 3 Weeks Ago at 04:54 AM.

  3. #3
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    The article incorrectly calls "\e[1;1H\e[2J" a "regex".
    It is, of course, an ANSI escape sequence.
    ANSI escape code - Wikipedia

    Even Windows seems to respond to these now, although I don't think \e is a standard character escape code in C. Alternatively, it can be written in octal \033 or hex \x1b: printf("\033[1;1H\033[2J")
    A little inaccuracy saves tons of explanation. - H.H. Munro

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Clear Console Screen
    By Cero.Uno in forum C Programming
    Replies: 3
    Last Post: 04-21-2008, 03:45 PM
  2. Clear Screen in C++ console
    By ay_okay in forum C++ Programming
    Replies: 9
    Last Post: 12-21-2004, 04:05 AM
  3. Clear the Console Screen
    By Gnoober in forum C++ Programming
    Replies: 4
    Last Post: 10-15-2002, 05:28 PM
  4. clear the screen in console input
    By enggas in forum Linux Programming
    Replies: 4
    Last Post: 07-23-2002, 12:06 PM
  5. clear screen
    By programmer in forum C++ Programming
    Replies: 2
    Last Post: 12-09-2001, 02:53 PM

Tags for this Thread