I dont know how... Help...
G++ 2.96.
Printable View
I dont know how... Help...
G++ 2.96.
I've always typed 'clear' at the command line. Hope this is the answer that you're looking for.
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:
Works the same for Windows Console only you use the cls command rather than clear.Code:system("clear");
Good luck
I usually use a preprocessor macro to save keystrokes later on....
i.e.
Code:#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.
from the faq:
Code:#include <curses.h>
void clrscr()
{
static int init;
if (init == 0)
{
initscr();
init = 1;
}
clear();
refresh();
}
works in linux only though.
#define clear printf("\033[2J\033[0;0f");
Works on any Terminal which supports vt100Quote:
Originally posted by kwigibo
works in linux only though.
#define clear printf("\033[2J\033[0;0f");
>#define clear printf("\033[2J\033[0;0f");
nifty, how does it work?
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.
Which fact??? :-/Quote:
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).
You've only posted one previous message on this thread... can't be too hard to guess which one kwigibo is talking about! :DQuote:
Originally posted by shaik786
Which fact??? :-/