CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2002
    Location
    Germany
    Posts
    20

    clear screen in console

    Hi,

    how can I clean the console screen?
    Okay, I can use system("clear"); or system("cls"); but I don't want to use system commands.

    Thanks,
    Alexander

  2. #2
    Join Date
    May 2002
    Location
    United Kingdom
    Posts
    13
    Use BIOS/DOS calls .. Some Interrupt.

    You will have to code Assembly in C/C++

    Cheers
    V

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: clear screen in console

    Originally posted by AlexanderS
    Hi,

    how can I clean the console screen?
    Okay, I can use system("clear"); or system("cls"); but I don't want to use system commands.

    Thanks,
    Alexander
    If your console is 25 lines:
    Code:
    #include <iostream>
    void ClearConsole( )
    {
        for ( int i =0; i < 25;  ++i )
           std::cout << std::endl;
    }
    Other than that, there is no standard way in C++ to clear the console, or do any kind of console related programming. All of this is OS and compiler dependent, so you need to do research on the functions that your compiler supports in doing these things, or check how your OS does these things.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Apr 2000
    Location
    Frederick, Maryland
    Posts
    507

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured