Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fender2112

macrumors 65816
Original poster
Aug 11, 2002
1,143
417
Charlotte, NC
I'm using Xcode to learn C++. So far things are simple and output goes to a command window. What is the command that clears the old junk from this command window?
 
I haven't tried it but you might try an ASCII form feed character, as that used to clear ANSI x.364 terminals.
 
Try this

I think this is what you are looking for - choose Debug -> Clear Logs

Edit : Also, if this is what you are looking for, you can set a preference ( General -> Automatically clear logs). It will clear the command window each time you run the program.
 
If you want to clear it manually, there's a small grey X below the vertical scroll bar.
 
Using google here's what I think I need.

I need clscr() which in found in #include <conio.h> But this file does not exit in Xcode's version of c++

There is also this command: system ("cls"); but this doesn't work on OS X.

I also found this: clear. But I'm not sure of the syntax.
 
Using curses ithrough Python it's
Code:
myWindow.clear()
where myWindow is a curses window. You could make a window the size of the screen or
Code:
screen.clear()
might also work directly, I'm not sure. Screen is automatically defined when you use curses.
 
Fender2112 said:
Using google here's what I think I need.

I need clscr() which in found in #include <conio.h> But this file does not exit in Xcode's version of c++

There is also this command: system ("cls"); but this doesn't work on OS X.

I also found this: clear. But I'm not sure of the syntax.
Well, clear is the terminal command, so system("clear"); could work.
 
Just for playing around and learning, you can use the string "\e[H\e[2J" to clear a VT100-style terminal. You're really supposed to use ncurses for that kind of thing, but that's more evil than you probably want to deal with at the start.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.