473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Clear display

Hi

I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?
Jul 19 '05 #1
6 14513
Maxd out wrote:
Hi

I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?


Clearing the screen is a platform specific issue since many platforms
do not support screens. Read the FAQ and welcome.txt below for
more assistance with screen clearing.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 19 '05 #2
"Maxd out" <ni****************@bigpond.com> wrote in message news:<oS*******************@news-server.bigpond.net.au>...
Hi

I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?


Do you mean outputting something and then clearing the screen?
On DOS/Windows you could probably just do this:

#include<cstdlib>
system("command /c cls");

This is equivalent to typing 'cls' on the command line. Since cls is
a command that is built-in (internal) to command.com, you can't just
say system("cls"). This is because system() needs a real program file
to execute, it can't 'type' commands on the command line like you can
do yourself. :)

If you're on a Linux/Unix system, I think there's a similar solution
there.

Hope I didn't answer the wrong question!
Jul 19 '05 #3
"Maxd out" <ni****************@bigpond.com> wrote:
I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?


By clear the display, do you mean wipe the screen clean and start over
at the top line? Or are you talking about something inside of
iostreams, clearing buffers?

For clearing the display like I guessed, that can't be done with
Standard C++ alone. If it's a VT100 terminal, you could send
"\033[H\033[J", which tends to work... but if that doesn't work, or
you want to know more about terminal control, you'll have to look for
a spec, library, or group on ansi terminals, since they aren't part of
standard C++.

--
Dave O'Hearn
Jul 19 '05 #4
Thank you all for your input, it's given me a lot to think about.
The cls for clear screen sounds logical, but i will also goto the suggested
sites to learn more and try all suggestions.
Thanks again
"Dave O'Hearn" <da******@pobox.com> wrote in message
news:3e**************************@posting.google.c om...
"Maxd out" <ni****************@bigpond.com> wrote:
I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?


By clear the display, do you mean wipe the screen clean and start over
at the top line? Or are you talking about something inside of
iostreams, clearing buffers?

For clearing the display like I guessed, that can't be done with
Standard C++ alone. If it's a VT100 terminal, you could send
"\033[H\033[J", which tends to work... but if that doesn't work, or
you want to know more about terminal control, you'll have to look for
a spec, library, or group on ansi terminals, since they aren't part of
standard C++.

--
Dave O'Hearn

Jul 19 '05 #5
torhu wrote:
"Maxd out" <ni****************@bigpond.com> wrote in message news:<oS*******************@news-server.bigpond.net.au>...
Hi

I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?

Do you mean outputting something and then clearing the screen?
On DOS/Windows you could probably just do this:

#include<cstdlib>
system("command /c cls");

This is equivalent to typing 'cls' on the command line. Since cls is
a command that is built-in (internal) to command.com, you can't just
say system("cls"). This is because system() needs a real program file
to execute, it can't 'type' commands on the command line like you can
do yourself. :)

If you're on a Linux/Unix system, I think there's a similar solution
there.

Hope I didn't answer the wrong question!


So, how do I clear the screen on an embbedded system for a laser
printer?

Is there a standard method to do this?

Perhaps this is why people redirect these issues to the newsgroup
dedicated to the platform.

There are more platforms than just Windows, Linux, Unix, etc.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Jul 19 '05 #6
"torhu" <th******@hotmail.com> wrote in message
news:25************************@posting.google.com ...
I'm wondering if you can clear a monitor display cout that asks for
something after it's been read in by cin e.g;
cout <<"Enter number" <<endl;
If so how can it be done?


Do you mean outputting something and then clearing the screen?
On DOS/Windows you could probably just do this:

#include<cstdlib>
system("command /c cls");

This is equivalent to typing 'cls' on the command line.


Oh, please. How about something a little nicer:

==========================
// CLS.C

#include "dos.h"

void main (void)
{
union _REGS inregs, outregs;

inregs.x.cx = 0x00; // upper left corner
inregs.x.dx = 0x2479; // lower right corner
inregs.h.bh = 0x07; // screen attribute
inregs.x.ax = 0x0600; // BIOS interrupt
_int86 (0x10, &inregs, &outregs);

}

==========================

-
ArWeGod
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Cezar | last post by:
Hi! To clear both of side I use this code: hr.clear{ display:block; clear:both; visibility:hidden; height:0; border-width:0;
17
by: kimimaro | last post by:
How do you limits employee display where you enter the department for all the employee within that department be displayed and if lets say they are 100 or so and you have to limits 10 employee per...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
4
by: Dave | last post by:
TIA for the help.....this should be easy for a pro....I need the two divs with text to display on the same line at the top of the container..??? <html> <head> <style> body...
2
by: nickyeng | last post by:
i have a function that clear the screen and then display array to cout. i compiled no error no warning, i run it, the screen really get "clear" but it does not display anything to cout, and it...
8
by: nickyeng | last post by:
I have written 3 files, i dont know whether i do it correctly or wrongly but somehow it compiled well and can run. My simple aim is to display the terrain.txt file into the terrain array, and then...
10
arunmib
by: arunmib | last post by:
Hi all, while printing on a monitor, I want to remove the last printed line and replace it with a new string. My doubt will be better explained with the following example. int main() { ...
5
by: plumba | last post by:
Ok, another query.... I have a checkbox at the bottom of my form which when checked unhides a <div> block which displays the submit button. The problem I have is when the clear form button is...
2
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.