0

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 ..

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by death_oclock
0

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};
  CONSOLE_SCREEN_BUFFER_INFO csbi;

  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 );
}
0

ok, the first thing works, e.g.

for(int i=0; i<10; i++) {
   cout << i; 
   sleep(3);
   system("clear");
}

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

thanks for your reply

0

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.

0

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

anyway thank you very much for your reply.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.