Thread: clearing the screen

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    27

    clearing the screen

    is there any way in c to clear the console

    ie in dos you would use cls
    pascal clrscr

    how do you do it in c?

  2. #2
    Registered User
    Join Date
    Aug 2004
    Posts
    21
    If you are using MS Visual C++, it will be

    First declare the header file #include<stdlib.h>
    and the clear console function is system("CLS")

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    27
    Thanks alot i needed it for a project which has to be in in twenty mins thanks

  4. #4
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    This topic is discussed in the FAQ.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by bennyho03
    If you are using MS Visual C++, it will be

    First declare the header file #include<stdlib.h>
    and the clear console function is system("CLS")
    stdlib.h is a standard header so the system() function can be used in any ANSI C compiler not just MSVC

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >stdlib.h is a standard header so the system() function can be used in any ANSI C compiler not just MSVC
    Using "CLS" as an argument is not quite as portable though. Then there are the "other" issues with system.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. clearing the screen
    By ssharish in forum C Programming
    Replies: 2
    Last Post: 02-01-2005, 09:00 PM
  4. 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, 02:41 AM
  5. Clearing the screen
    By Shadow in forum C Programming
    Replies: 4
    Last Post: 05-23-2002, 01:40 PM