Substitute for system("cls")`

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

Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Substitute for system("cls")`

 
0
  #1
Dec 12th, 2008
The question is in the title. Rather then making a call to the OS, is there a more efficient way to do this? Thanks

Edit: Just though of something else to.
Does Sleep(2000); make a call to the OS as well? If so is there another way to do this as well?
Last edited by clutchkiller; Dec 12th, 2008 at 4:13 pm.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,249
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 540
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Substitute for system("cls")`

 
0
  #2
Dec 12th, 2008
Both sleep and cls are non-portable.

There is no portable method to clear the screen

Thats because you cant guarauntee the output device is nececerially the screen. e.g on an embedded device it could be a typewriter or something
Last edited by jbennet; Dec 12th, 2008 at 4:15 pm.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,789
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 746
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Substitute for system("cls")`

 
1
  #3
Dec 12th, 2008
>is there a more efficient way to do this?
You mean without moving away from the console for non-sequential output? You could try pdcurses or something similar. At least that way you have more control, but if you're doing any kind of GUI-like interface or advanced drawing, you'd be better off taking the plunge into a modern graphics API.

>Does Sleep(2000); make a call to the OS as well?
How exactly are you expecting to talk to the system or any peripherals without making a call to the OS?
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: Substitute for system("cls")`

 
3
  #4
Dec 12th, 2008
> How exactly are you expecting to talk to the system or any peripherals without making a call to the OS?

On some operating systems and some devices, you can do just that.
Last edited by Rashakil Fol; Dec 12th, 2008 at 6:26 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,789
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 746
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Substitute for system("cls")`

 
1
  #5
Dec 12th, 2008
>On some operating systems and some devices, you can do just that.
Yes, but on the OP's operating system and device? Unlikely.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Re: Substitute for system("cls")`

 
0
  #6
Dec 12th, 2008
not looking for a flame war guys lol. Thanks for the input.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,789
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 746
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Substitute for system("cls")`

 
1
  #7
Dec 12th, 2008
No worries, Rash knows better than to get into a flame war with me.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 90
Reputation: unbeatable0 is an unknown quantity at this point 
Solved Threads: 12
unbeatable0 unbeatable0 is offline Offline
Junior Poster in Training

Re: Substitute for system("cls")`

 
0
  #8
Dec 13th, 2008
Look at this link:
http://faq.cprogramming.com/cgi-bin/...&id=1043284385
The last method is probably what you're looking for.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 17
Reputation: AHUazhu is an unknown quantity at this point 
Solved Threads: 2
AHUazhu AHUazhu is offline Offline
Newbie Poster

Re: Substitute for system("cls")`

 
0
  #9
Dec 13th, 2008
what about WinExec("cls"); ?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Substitute for system("cls")`

 
0
  #10
Dec 13th, 2008
Notes on system() and equivalent functions.

A guy walks up to a rack of fireworks blindfolded. After a short period of time, he mutters something and there's a huge explosion.

First Onlooker: What did he say?
Second Onlooker: I think it was "Is it lit yet?"
Reply With Quote Quick reply to this message  
Reply

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



Other Threads in the C++ Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC