Clearing the screen

Tell me, please, is there a function for cleaning the screen in C++? Do not offer to use the conio library: because it is not standard and is used exclusively for Windows, just do not waste time and do not offer loops with a bunch of null character outputs. I googled what you can do:

system("clear");

But the g++ compiler outputs:

static.cpp:29:19: error: ‘system’ was not declared in this scope

That is, I would like to see a library and a cleanup operator or a library for systems ("") for C++.

 2
Author: Tomagavk, 2011-05-16

3 answers

To make system("clear") work, connect stdlib. h For windows system ("cls");

Cross-platform version:

if (system("clear")) system( "cls" );

 6
Author: Raslav, 2011-05-17 09:05:10
  1. conio.h is really not under nix.
  2. No one prevents you from using a library like terminfo and/or (n)curses. They are quite standard for *nix
  3. there are no cls under nix either :) Pure Windows pribluda
  4. And what prevents to make some exec for bash with the necessary parameters instead of system ()?
  5. Or do

    Std::cout

As many times as you need (and how many times do you need? here's the question).

 1
Author: gecube, 2011-05-16 14:11:04

Clrscr();

Try

 0
Author: fluxx, 2011-05-18 20:34:09