clear screen

This is a discussion on clear screen within the C Programming forums, part of the General Programming Boards category; Can anyone tell me if there is a specific function to clear the screan that is ANSI compatible?...

  1. #1
    Unregistered
    Guest

    clear screen

    Can anyone tell me if there is a specific function to clear the screan that is ANSI compatible?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Borland C++ has a function called clrscr() in the conio.h header file. Check your compiler's help files and get a listing of the built in functions.

    -Prelude

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    reply

    try: system("cls");

    or if you use a DOS based compiler: clrscr();

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Its in the FAQ !!
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Satan valar_king's Avatar
    Join Date
    Aug 2001
    Posts
    288
    does anyone look at the FAQ?
    -Save the whales. Collect the whole set.

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    101
    Can anyone tell me if there is a specific function to clear the screan that is ANSI compatible?
    ANSI has not provided such a function because as far as the standard is concerned, there may be no screen to clear.
    - lmov

  7. #7
    Registered User
    Join Date
    Sep 2001
    Location
    Australia
    Posts
    212
    As mentioned there is not an ANSI clear screen function the stdlib.h provides you with the system("cls") also mentioned earlier but this is not really portable. "cls" does not clear the screen in UNIX based systems and the rest who cares about

    But anyways you could use the ANSI Escape Sequences it was in an earlier post. But to clear the screen use this.

    Code:
    printf("\033[2J");    //Clears the screen
    printf("\033[0;0f");   //Sets the cursor to the start
    But be warned on DOS systems the ANSI.sys file must be loaded from the config.sys file. And UNIX it works all the time (or it has for me so far)

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