"Clear Screen" Function in C++?

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

  1. macrumors 6502a

    steelphantom

    Joined:
    Oct 15, 2005
    #1
    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. macrumors 68020

    pknz

    Joined:
    Mar 22, 2005
    Location:
    NZ
    #2
    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. Moderator emeritus

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

    steelphantom

    Joined:
    Oct 15, 2005
    #4
    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. macrumors 6502a

    Joined:
    Jun 17, 2003
    #5

Share This Page