CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Location
    Co'Co Island
    Posts
    65

    How do you clear the screen on C++?

    Hi, how do you clear the screen on C++? on VB you used cls to clear the screen, but I don't know what function to use thanks for the help.

  2. #2
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    Have a look at http://msdn.microsoft.com/library/de...the_screen.asp

    Techniques are a bit naff. Alternatively, if you have ansi.sys loaded, just print

    "\033[2J"
    Succinct is verbose for terse

  3. #3
    Join Date
    Jun 2002
    Posts
    936
    You can try

    #include <conio.h>

    and

    call the function

    clrscr();

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

    Re: How do you clear the screen on C++?

    Originally posted by beginner_c++
    Hi, how do you clear the screen on C++? on VB you used cls to clear the screen, but I don't know what function to use thanks for the help.
    First, there is no function in standard C++ to clear the screen.

    There may be functions that are specific to your operating system that clear the screen. Again, it all depends on the OS that you are running (and compiler brand counts also -- one compiler may call the function cls(), while another may call it clrscr(), while another may call it ClearTheScreen()).

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; April 14th, 2004 at 01:59 PM.

  5. #5
    Join Date
    Apr 1999
    Posts
    27,449
    Originally posted by vcstarter
    You can try

    #include <conio.h>

    and

    call the function

    clrscr();
    If the OP is running anything other than Visual C++, this may not even compile, let alone run.

    Regards,

    Paul McKenzie

  6. #6
    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    762
    <cstdlib>

    system("cls");

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