There is no generic command to clear the console on both platforms.
#include <cstdlib>
void clear_screen()
{
#ifdef WINDOWS
std::system("cls");
#else
// Assume POSIX
std::system ("clear");
#endif
}
More Related Contents:
- C++ cross-compiler from Windows to Linux [closed]
- How do I get console output in C++ with a Windows program?
- C++ compiling on Windows and Linux: ifdef switch [duplicate]
- Win32 programming hiding console window
- Sharing a global/static variable between a process and DLL
- When including header files, is the path case sensitive?
- What is the Best Practice for Combating the Console Closing Issue?
- C++ console keyboard events
- Detect Windows or Linux in C, C++ [duplicate]
- Possible causes for Boost not being found by CMake in certain situations?
- generates same number in Linux, but not in Windows
- How can I cin and cout some unicode text?
- What’s the difference between 'gcc -g' and 'gcc -g3'?
- How to get main window handle from process id?
- Deploying Qt 5 App on Windows
- Linux: Executing child process with piped stdin/stdout
- Start Windows Service From Application without Admin right(c++)
- Create a directory if it doesn’t exist
- Can I use CreateFile, but force the handle into a std::ofstream?
- What is the meaning and usage of __stdcall?
- How should I use FormatMessage() properly in C++?
- fork() and output
- Converting YUV into BGR or RGB in OpenCV
- Win32: How to hide 3rd party windows in taskbar by hWnd
- Can’t get visual studio C++ include file ‘excpt.h’ to get installed
- Is “std::cout” usable in Android-ndk
- cannot convert parameter 1 from ‘char’ to ‘LPCWSTR’
- What is the maximum memory available to a C++ application on 32-bit Windows?
- How to get the starting/base address of a process in C++?
- DoEvents equivalent for C++?