How to clear screen

I searched the post and someone said to clear the screen in C, use

printf("\033[2J"); ??

However, this doesn't work...typo or no.

What is an equivalent command to 'CLS' in DOS/'clear' in UNIX to clear the screen and go to top of screen??

Thank you.

Take a look at the curses package. You probably have a "man curses" or "man curses_intro" or something. Curses has a routine clear() that should do what you want. I think you will need to call initscr() once in the program first to set stuff up.

For this to work your TERM variable must be set correctly and you must have a good entry in termcap or terminfo. If can run a full screen editor like vi then you should ok. vi uses curses.

This should give you an answer to your question:

A really good FAQ, but mostly C++ though