If (!GetConsoleScreenBufferInfo( hStdOut, &csbi )) return ĬellCount = *csbi.dwSize. * Get the number of cells in the current buffer */ If (hStdOut = INVALID_HANDLE_VALUE) return HStdOut = GetStdHandle( STD_OUTPUT_HANDLE ) Sadly, way is windows specific and involves either conio.h (and clrscr() may not exist, that's not a standard header either) or Win API method #include There are three ways to clear the screen in a console application. Outputting multiple lines to window console is just adds empty lines to it. Ncurses is a library that supports console manipulation: I have removed the link to the Microsoft article because of this problem. However it has been pointed out in the comments that this is not a safe thing to do. How do we clear the console in assembly?Įdit: This answer previously mentioned using system("cls"), because Microsoft said to do that.If it still makes sense to clear the console in your program, and you are interested in operating system specific solutions, those do exist.įor Windows (as in your tag), check out this link: Even if you could clear the console in C++, it would make those cases significantly messier. The program could be printing to a printer, outputting straight to a file, or being redirected to the input of another program for all it cares. C++ doesn't even have the concept of a console.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |