Clearing the screen

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2004
Posts: 6
Reputation: Lost Chyld is an unknown quantity at this point 
Solved Threads: 0
Lost Chyld Lost Chyld is offline Offline
Newbie Poster

Clearing the screen

 
2
  #1
Mar 17th, 2004
I'm working on a program with menus, but I don't know how to clear the screen before displaying the next menu.
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 28
Reputation: Bleek is an unknown quantity at this point 
Solved Threads: 0
Bleek Bleek is offline Offline
Light Poster

Re: Clearing the screen

 
2
  #2
Mar 21st, 2004
if its just in the dos screen

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
cout << "Hello World!" << endl;
system("cls");
cout << "End of program";
system("pause");
return 0;
}

you can put any dos command in the quotes... but make sure you include cstdlib
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 77
Reputation: infamous is an unknown quantity at this point 
Solved Threads: 2
infamous infamous is offline Offline
Junior Poster in Training

Re: Clearing the screen

 
1
  #3
Mar 23rd, 2004
linux: system("clear");
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 6
Reputation: Lost Chyld is an unknown quantity at this point 
Solved Threads: 0
Lost Chyld Lost Chyld is offline Offline
Newbie Poster

Re: Clearing the screen

 
0
  #4
Mar 24th, 2004
Thanx guys.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 141
Reputation: meabed is on a distinguished road 
Solved Threads: 3
Team Colleague
meabed's Avatar
meabed meabed is offline Offline
Junior Poster

Re: Clearing the screen

 
2
  #5
May 2nd, 2004
thnx guys but is there any anther way to do that without <cstdlib>?
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 219
Reputation: BountyX is an unknown quantity at this point 
Solved Threads: 7
BountyX's Avatar
BountyX BountyX is offline Offline
Code Guru

Re: Clearing the screen

 
0
  #6
May 2nd, 2004
nope clearing a terminal window is hadnled by the operating system's kernal, exclusively.
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 28
Reputation: Bleek is an unknown quantity at this point 
Solved Threads: 0
Bleek Bleek is offline Offline
Light Poster

Re: Clearing the screen

 
0
  #7
May 2nd, 2004
actually there is a way around that... you could cout a bunch of back spaces...

  1. cout << "\b\b\b\b\b\b";

or you could cout the ascii equivilent
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 2
Reputation: Snyper is an unknown quantity at this point 
Solved Threads: 0
Snyper's Avatar
Snyper Snyper is offline Offline
Newbie Poster

Re: Clearing the screen

 
1
  #8
May 4th, 2004
Yea u can...backspaces need to b calculated...however thers a simple approach to the problem
jus print the required number of newline chars i.e '\n'
use the following code:
for(int i=1;i<26;i++)
cout<<"\n';

if ur program works on a loop structure then i'd suggest using the system("clear") option (Linux) or system("cls") for Windows
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 5
Reputation: skywing is an unknown quantity at this point 
Solved Threads: 0
skywing's Avatar
skywing skywing is offline Offline
Newbie Poster

Re: Clearing the screen

 
1
  #9
May 4th, 2004
#include <conio.h>
......
main() {
.....
clrscr();
.....
}
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 141
Reputation: meabed is on a distinguished road 
Solved Threads: 3
Team Colleague
meabed's Avatar
meabed meabed is offline Offline
Junior Poster

Re: Clearing the screen

 
0
  #10
May 11th, 2004
Thnx Guys
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC