As in the title. How can I clear console in C++?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
outputting multiple lines to window console is useless..it just adds empty lines to it. 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
For POSIX system it's way simpler, you may use ncurses or terminal functions
Here is a simple way to do it:
This is REALLY choppy but try:
Use System::Console::Clear();
This will clear (empty) the buffer
In Windows:
In Linux/Unix:
For Windows, via Console API:
It happily ignores all possible errors, but hey, it's console clearing. Not like
system("cls")
handles errors any better.For *nixes, you usually can go with ANSI escape codes, so it'd be:
Using
system
for this is just ugly.