Windows console... clearscreen?

This is a discussion on Windows console... clearscreen? within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I was wondering if there is a clear screen function when using InterDev to compile and run my C ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    8

    Question Windows console... clearscreen?

    Hi,

    I was wondering if there is a clear screen function when using InterDev to compile and run my C code ?

    im used to using an old borland compiler which had clrscr()

    anything resembling that in interdev?

    Cheers,
    Kev

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    8
    thanks

    but i have to do it in C not C++

    Cheers,
    Kev

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Read the FAQ then you wouldnt have to ask pointless questions.
    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
    Registered User
    Join Date
    Apr 2003
    Posts
    8
    oooh look another friendly forum....

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    If you check, you'll find this is a friendly forum. If you search the boards, you'll also find that question is probably the most asked question, the answers have been given many times, and are in the FAQ, which is what the FAQ is for.

    This is the internet, wherever you go, a dumb or unresearched question is likely to get either flames or misleading replies, if any at all. I'm afraid you going to have to live with that, 'cos that's the way it is.

    The section of the FAQ dealing with this topic can be found here.

    Thread closed.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  7. #7
    Registered User Machewy's Avatar
    Join Date
    Apr 2003
    Posts
    42

    Here you go:

    What you got to do is this:

    Include the header file <stdlib.h>
    This is for dos commands.
    The dos command for 'clear screen' is 'cls'

    Here is an example of how to use it:
    PHP Code:
    include <iostream.h>
    include <
    stdlib.h>

    int main()
    {
     
    cout<< " Hello world ";
     
    system("PAUSE"); // remember to include the system command
     // Pause is the Command that says ' press any key to continue..'
     
    system("cls");       // clears screen
     
    cout<< "This is a new screen";
     
    system("PAUSE"); // Pauses for user's reaction
     
    return 0;

    It is as simple as that.
    "All things come to an end"

  8. #8
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    please never recommend the system() function. You should probably forget that it even exists as there is always a better way of doing what that accomplishes. Read 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

  9. #9
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Oooh, looks like I forgot to close it!

    SC is right, read the FAQ, there is always a better way to do something than system().
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FlashWindowEx not declared?
    By Aidman in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 03:58 AM
  2. Question about console and windows programming
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 06-22-2002, 06:46 AM
  3. multiple console windows
    By gordy in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-13-2002, 11:05 PM
  4. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM
  5. windows dos console
    By dune911 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-16-2002, 11:30 PM

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