"Clear Screen" Function in C++?

Discussion in 'Mac Programming' started by steelphantom, Mar 22, 2006.

  1. steelphantom macrumors 6502a


    Oct 15, 2005
    Right now I'm working on a simple C++ maze program and I want to clear the screen and redraw the maze every time the user makes a move. I know on Windows there is the system("cls") function (or something like that) that does this, but I couldn't find an equivalent that will work with my compiler on OS X. I tried clrscr(); but I got an error that it wasn't declared within my header file. Do I just need to include another header file, or is there a completely different function that does this?
  2. pknz macrumors 68020


    Mar 22, 2005
    What header files do you have?
    I think these are needed, not sure which one in particular...

    #include <conio.h>
    #include <iostream.h>
    #include <stdlib.h>
    #include <fstream.h>
  3. bousozoku Moderator emeritus

    Jun 25, 2002
    Gone but not forgotten.
    I could swear this issue was recently discussed and resolved. Perhaps, a search of the forum would help.
  4. steelphantom thread starter macrumors 6502a


    Oct 15, 2005
    Yep. Got it. system("clear"); should work. I didn't recall reading a thread about this before, but I just did a search, and BAM! there it was! :eek:
  5. mrichmon macrumors 6502a

    Jun 17, 2003

Share This Page