| | |
Flashing the output to the screen for a limited time
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 2
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 ..
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 ..
•
•
Join Date: Mar 2008
Posts: 1,430
Reputation:
Solved Threads: 118
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:
C++ Syntax (Toggle Plain Text)
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 ); }
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 2
ok, the first thing works, e.g.
but have no understanding on your second soluction. Is there a lib that should i use;
thanks for your reply
C++ Syntax (Toggle Plain Text)
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
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 2
i am with opensuse 11 and system("clear") works
(system("pause")) donot work)
anyway thank you very much for your reply.
(system("pause")) donot work)
anyway thank you very much for your reply.
Using system() commands is not a good idea, and windows specific functions are not a great solution either. You can use Clock() instead of sleep. Also, check out these special control characters as a way of clearing the screen.
![]() |
Other Threads in the C++ Forum
- Previous Thread: simple text editor
- Next Thread: Creation of an application
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamic email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






