View Full Version : Clear the Screen...
Yoshi
06-25-2002, 08:46 PM
I dont know how... Help...
G++ 2.96.
Fyodorox
06-25-2002, 09:02 PM
I've always typed 'clear' at the command line. Hope this is the answer that you're looking for.
biosx
06-25-2002, 09:46 PM
In stdlib.h there is a function called system() which allows you to pass arguments to the shell. You use this injunction with the clear command for Bash like so:
system("clear");
Works the same for Windows Console only you use the cls command rather than clear.
Good luck
Fyodorox
06-26-2002, 07:17 AM
I usually use a preprocessor macro to save keystrokes later on....
i.e.
#define CLEAR system("clear") //you can name clear anything, but it's usually good advice to with the actual system name.
howdy,
system() calls are platform dependent and will cause great stress if you try to cross platforms with your code.
in console use a loop
void clrscrn()
{
for(int i = 0; i < 100; i++)
cout<<"\n";
}
it's a little messy but it will clear the screen and it is platform independent.
M.R.
stautze
06-27-2002, 01:16 AM
from the faq:
#include <curses.h>
void clrscr()
{
static int init;
if (init == 0)
{
initscr();
init = 1;
}
clear();
refresh();
}
kwigibo
06-28-2002, 07:17 PM
works in linux only though.
#define clear printf("\033[2J\033[0;0f");
shaik786
06-29-2002, 05:42 AM
Originally posted by kwigibo
works in linux only though.
#define clear printf("\033[2J\033[0;0f");
Works on any Terminal which supports vt100
stautze
06-29-2002, 05:25 PM
>#define clear printf("\033[2J\033[0;0f");
nifty, how does it work?
kwigibo
07-03-2002, 10:18 PM
shaik786, wasn't aware of that fact. I know that they are "ANSI Escape Sequences", and I tried them in windows nt4, and didn't work so I assumed they only worked onl *nix systems (which supports vt100).
howdy,
works pretty damn good in Linux.
M.R.
shaik786
07-03-2002, 11:06 PM
Originally posted by kwigibo
shaik786, wasn't aware of that fact. I know that they are "ANSI Escape Sequences", and I tried them in windows nt4, and didn't work so I assumed they only worked onl *nix systems (which supports vt100).
Which fact??? :-/
Hammer
07-04-2002, 05:51 PM
Originally posted by shaik786
Which fact??? :-/
You've only posted one previous message on this thread... can't be too hard to guess which one kwigibo is talking about! :D
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.