refresh screen

How I can refresh screen when i start my program.
LVL 5
JBURGHARDTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ramaswamysCommented:
You can use 'xrefresh' - a standard application that ships with most Unix and Linux distributions.

Ramaswamy
0
JBURGHARDTAuthor Commented:
well I want to know this using c++ since this is programing question
how to use clrscr(); refresh(),
0
ramaswamysCommented:
Oops, Sorry ! Well if you want to clear a terminal please refer to the curses library documentation or If you are doing X-windows programming you have calls like XClearArea(), XClearWindow(), etc.

Good Luck
Ramaswamy
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

paitreEnterprise Support ArchitectCommented:
There are also the generic terminal escape sequences that may or may not work (it really depends on the terminal).
ie: ESC[2J (\x1B[2J) is used to clear the screen and it's also supposed to home the cursor.  I've used this particular sequnce a lot and it generally works (both in C and C++).
0
serena77Commented:
Here are some macros you could use as paitre sugested below:

#define CCLR "\033\143\x1B[2J" /* reset and clear screen */

Also if you're interested:

#define CUDL  "\x1B[4m" /* underline */
#define CFSH  "\x1B[5m" /* flashing (mihgt not work, depending on your  term) */
#define CRVS  "\x1B[7m" /* reverse video */
#define CNRM  "\x1B[0;0m" /* normal (disable special attributes) */
0
pessoaCommented:
using ansi escape sequences is extremely evil and unportable
one should definately use a terminal capability database
such as termcap or terminfo
this is comfortably done by using a library
such as ncurses or slang , both easily found on freshmeat
for small manipulations, such a library is too much of an
overhead, so termcap or terminfo should be consulted
directly.
0
pessoaCommented:
Here's a very minimal solution using the ncurses library
#include <curses.h>
int main {
initscr();clear();refresh();
/*everything interesting goes here */
endwin ();}
initscr () checks the terminal's abilities and size, it has to be called before doing anything that manipulates the terminal, with a few rarely useful exceptions. in programs using multiple terminals, newterm () is used instead of initscr ().
clear () copies blanks into every position of the virtual screen. refresh copies the virtual screen into the physical screen, i.e. it's after successfully calling this function that the screen appears cleared.
endwin() should be called before leaving a program using curses to clean the terminal up. Otherwise it may stay in a mess. Use endwin religiously in signal handlers and atexit() instructions.
it is not recommended to use ncurses just for this one operation. i can present a solution using the GNU termcap library instead, later on. ncurses is not part of the (g)libc, but has to be linked explicitely by e.g -lncurses on the gcc commandline.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JBURGHARDTAuthor Commented:
Adjusted points to 400
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.