hi you all..

i want to flash the output message to the screen for a limited time. can you plz help me ?

is there something in iomanip, or should i do something with system("pause") and system("clear").. although the latest dont seem to me like a good solution ..

Look up the Sleep function to use as a delay for the message. To clear the screan, you can either use the "system("cls"), or better, do it manually:

void Clear() {
  DWORD n;
  DWORD size;
  COORD coord = {0};

  HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );

  GetConsoleScreenBufferInfo ( h, &csbi );

  size = csbi.dwSize.X * csbi.dwSize.Y;

  FillConsoleOutputCharacter ( h, TEXT ( ' ' ), size, coord, &n );
  GetConsoleScreenBufferInfo ( h, &csbi );
  FillConsoleOutputAttribute ( h, csbi.wAttributes, size, coord, &n );

  SetConsoleCursorPosition ( h, coord );

ok, the first thing works, e.g.

for(int i=0; i<10; i++) {
   cout << i; 

but have no understanding on your second soluction. Is there a lib that should i use;

thanks for your reply

That is a windows only solution to clearing the screen, if you're using linux, you should either use system("clear") or use a portable library like ncurses.

i am with opensuse 11 and system("clear") works
(system("pause")) donot work)

anyway thank you very much for your reply.

This article has been dead for over six months. Start a new discussion instead.