Xcode

I recently switched to xcode from microsoft visual C++ so:
how do you clear the screen
how do you change the screen color
and how do you make a pause (before i used
#include <ctime>
and
clock_t now;
now = clock();
while( clock() < now+2000 ) {}
how do you clear the screen
how do you change the screen color
and how do you make a pause
You usually don't need to care about these things, but see http://www.cplusplus.com/forum/articles/7311/
what do you mean by not caring?
Also, i found clearing system("clear");
and pauses system(1);
but not the screen color
Last edited on
You can pause using Sleep() on Windows, or sleep() on OS X or any other POSIX. The difference is the parameter in Windows is in milliseconds, rather than seconds on POSIX.

As for all the console stuff, see http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx
thank you but im not using windows (and i think i ment sleep instead of system)
That's me getting is wrong again.

If you want to control a terminal, you might want to consider using a curses library.
thank you
im sorry but i am not familiar with the curses library can you please briefly explain it
http://lmgtfy.com/?q=ncurses

You may want to read the Wikipedia link first.
you can try and use VT100 escape sequences. may even work in DOS box.

http://www.umich.edu/~archive/apple2/misc/programmers/vt100.codes.txt

if you look at my latest post here: http://www.cplusplus.com/forum/general/27198/

I am playing with io manipulators, though it's in progress.
not finished it yet. may be better ways to do it.
may be of use, no warranty.
so I can do stuff like this...

1
2
3
4
5
6
7
    cout << clear << blink << "hello\n";
    cout << reset;
    cout << fg_yellow << bg_blue;;
    cout << "oi oi";
    cout << moveto(10,10) << bg_yellow << fg_blue << blink << "ponce features";
    cout << up(2) << "help" << left(14) << "up two";


ok ill try it l8r because it sounds complex and i am a begginer
not really, once you get the hang.
you on a mac?
if you open a command line terminal you can play with it,

"\033" is the ESCAPE character in octal

for example
1
2
printf "\033[5m"  # turn blink on
printf "\033[0m" # clear all attributes 
Last edited on
ok ill try it l8r because it sounds complex and i am a begginer
See why you shouldn't care about TUI?
ya when I do that should I take out the # turn blink on
Topic archived. No new replies allowed.