469,572 Members | 1,307 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Clear Screen?

How do I clear the text from my screen, other than a bunch of \n's or
endl's?

Tim M.
Jul 19 '05 #1
18 59238
"Tim Mierzejewski" <ti******@yahoo.com> wrote...
How do I clear the text from my screen, other than a bunch of \n's or
endl's?


Please read FAQ 15.20. You can find FAQ
here: http://www.parashift.com/c++-faq-lite/

Victor
Jul 19 '05 #2
Tim Mierzejewski wrote:
How do I clear the text from my screen, other than a bunch of \n's or
endl's?


C++ can not clear the screen, as indicated in the FAQ Victor pointed you to.
However, you can ask the OS to do it for you. The most common ways to do
this are 'system("cls");' in Windows and system("clear");' in Linux. The
system function is defined in <process.h>

--
Unforgiven

"Not only do I not know the answer
I don't even know what the question is"
My world - Metallica

Jul 19 '05 #3

"Unforgiven" <ja*******@hotmail.com> wrote in message
news:bd************@ID-136341.news.dfncis.de...
Tim Mierzejewski wrote:
How do I clear the text from my screen, other than a bunch of \n's or
endl's?
C++ can not clear the screen, as indicated in the FAQ Victor pointed you

to.

Huh? C++ can do a lot of things using the OS specific libraries. Dont say
C++ cannot clear the screen. Instead, you should say standard C++ cannot
clear the screen.

However, you can ask the OS to do it for you. The most common ways to do
this are 'system("cls");' in Windows and system("clear");' in Linux. The
system function is defined in <process.h>

--
Unforgiven

"Not only do I not know the answer
I don't even know what the question is"
My world - Metallica

--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com http://www.softwarefreaks.com
Jul 19 '05 #4
"Ashish" <as*****@hotmail.com> wrote...

"Unforgiven" <ja*******@hotmail.com> wrote in message
news:bd************@ID-136341.news.dfncis.de...
Tim Mierzejewski wrote:
How do I clear the text from my screen, other than a bunch of \n's or
endl's?


C++ can not clear the screen, as indicated in the FAQ Victor pointed you

to.

Huh? C++ can do a lot of things using the OS specific libraries. Dont say
C++ cannot clear the screen. Instead, you should say standard C++ cannot
clear the screen.


That's the only C++ we speak of here.
Jul 19 '05 #5
"Ashish" <as*****@hotmail.com> wrote...

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...

"Unforgiven" <ja*******@hotmail.com> wrote in message
news:bd************@ID-136341.news.dfncis.de...
> Tim Mierzejewski wrote:
> > How do I clear the text from my screen, other than a bunch of \n's or > > endl's?
>
> C++ can not clear the screen, as indicated in the FAQ Victor pointed you to.

Huh? C++ can do a lot of things using the OS specific libraries. Dont say C++ cannot clear the screen. Instead, you should say standard C++ cannot clear the screen.
That's the only C++ we speak of here.


Thats what I said too... but dont misguide the OP by saying that C++

cannot

Misguide?
do this, or can do that. Guide him to an appropriate newsgroup. I am sure
you understand that.


But in all honesty, C++ cannot clear the screen. It's some OS-
specific library call that does that. Or sequence of characters
output to console or ... But it is not a language thing. And,
by the way, while there exist extensions to the language created
by some eager compiler vendors, there is only one C++ -- Standard.

That's what we mean when we say "C++ cannot do that". Another
example: can C++ read files? Yes. Can C++ read JPEG files? Yes.
Can C++ read and display JPEG files? NO. Displaying them is not
a language feature. C++ cannot do that. Not standard, not any
other C++. The same with clearing the screen.

Guiding others to a particular newsgroup is a voluntary thing. If
you stop me in the street and ask whether I could give you a lift
to a town a thousand kilometres away, I'll probably say "No, sorry,
I cannot do that", but I am not obligated to explain to you all
possible options you have or direct you to a bus station. It is
up to you to figure that out. (Of course it might be mighty kind
of me to point you to a bus stop, and I _probably_ would do that
if I knew where you were going -- The OP just asked whether there
was a way to clear the screen except outputting newline characters,
and there isn't). See the point?

Anyway...

Victor
Jul 19 '05 #6

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...
>
> "Unforgiven" <ja*******@hotmail.com> wrote in message
> news:bd************@ID-136341.news.dfncis.de...
> > Tim Mierzejewski wrote:
> > > How do I clear the text from my screen, other than a bunch of
\n's
or
> > > endl's?
> >
> > C++ can not clear the screen, as indicated in the FAQ Victor
pointed you
> to.
>
> Huh? C++ can do a lot of things using the OS specific libraries.
Dont say
> C++ cannot clear the screen. Instead, you should say standard C++ cannot > clear the screen.

That's the only C++ we speak of here.


Thats what I said too... but dont misguide the OP by saying that C++

cannot

Misguide?
do this, or can do that. Guide him to an appropriate newsgroup. I am

sure you understand that.


But in all honesty, C++ cannot clear the screen. It's some OS-
specific library call that does that. Or sequence of characters
output to console or ... But it is not a language thing. And,
by the way, while there exist extensions to the language created
by some eager compiler vendors, there is only one C++ -- Standard.

That's what we mean when we say "C++ cannot do that". Another
example: can C++ read files? Yes. Can C++ read JPEG files? Yes.
Can C++ read and display JPEG files? NO. Displaying them is not
a language feature. C++ cannot do that. Not standard, not any
other C++. The same with clearing the screen.

Guiding others to a particular newsgroup is a voluntary thing. If
you stop me in the street and ask whether I could give you a lift
to a town a thousand kilometres away, I'll probably say "No, sorry,
I cannot do that", but I am not obligated to explain to you all
possible options you have or direct you to a bus station. It is
up to you to figure that out. (Of course it might be mighty kind
of me to point you to a bus stop, and I _probably_ would do that
if I knew where you were going -- The OP just asked whether there
was a way to clear the screen except outputting newline characters,
and there isn't). See the point?

Anyway...

Victor


I agree with you. But if you tell me that you cannot give me a lift to a
thown a thousand kilometers away doesnt mean that you should tell me that
there is no way I can go to that town. Thats what the other person did. He
said that C++ cannot... I am not saying that he or you HAVE to guide the OP
to an appropriate newsgroup, its voluntary ofcourse, but dont MISguide him
saying that it cannot be done. Get it?
--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com http://www.softwarefreaks.com
Jul 19 '05 #7

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...
>
> "Unforgiven" <ja*******@hotmail.com> wrote in message
> news:bd************@ID-136341.news.dfncis.de...
> > Tim Mierzejewski wrote:
> > > How do I clear the text from my screen, other than a bunch of
\n's
or
> > > endl's?
> >
> > C++ can not clear the screen, as indicated in the FAQ Victor
pointed you
> to.
>
> Huh? C++ can do a lot of things using the OS specific libraries.
Dont say
> C++ cannot clear the screen. Instead, you should say standard C++ cannot > clear the screen.

That's the only C++ we speak of here.


Thats what I said too... but dont misguide the OP by saying that C++

cannot

Misguide?
do this, or can do that. Guide him to an appropriate newsgroup. I am

sure you understand that.


But in all honesty, C++ cannot clear the screen. It's some OS-
specific library call that does that. Or sequence of characters


And those OS-specific libraries cannot be used using C++. I get it now.

Jul 19 '05 #8
"Ashish" <as*****@hotmail.com> wrote in message
news:bd************@ID-75446.news.dfncis.de...

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
> "Ashish" <as*****@hotmail.com> wrote...
> >
> > "Unforgiven" <ja*******@hotmail.com> wrote in message
> > news:bd************@ID-136341.news.dfncis.de...
> > > Tim Mierzejewski wrote:
> > > > How do I clear the text from my screen, other than a bunch of \n's or
> > > > endl's?
> > >
> > > C++ can not clear the screen, as indicated in the FAQ Victor pointed you
> > to.
> >
> > Huh? C++ can do a lot of things using the OS specific libraries. Dont say
> > C++ cannot clear the screen. Instead, you should say standard C++ cannot
> > clear the screen.
>
> That's the only C++ we speak of here.
>
>

Thats what I said too... but dont misguide the OP by saying that C++

cannot

Misguide?
do this, or can do that. Guide him to an appropriate newsgroup. I am sure you understand that.


But in all honesty, C++ cannot clear the screen. It's some OS-
specific library call that does that. Or sequence of characters
output to console or ... But it is not a language thing. And,
by the way, while there exist extensions to the language created
by some eager compiler vendors, there is only one C++ -- Standard.

That's what we mean when we say "C++ cannot do that". Another
example: can C++ read files? Yes. Can C++ read JPEG files? Yes.
Can C++ read and display JPEG files? NO. Displaying them is not
a language feature. C++ cannot do that. Not standard, not any
other C++. The same with clearing the screen.

Guiding others to a particular newsgroup is a voluntary thing. If
you stop me in the street and ask whether I could give you a lift
to a town a thousand kilometres away, I'll probably say "No, sorry,
I cannot do that", but I am not obligated to explain to you all
possible options you have or direct you to a bus station. It is
up to you to figure that out. (Of course it might be mighty kind
of me to point you to a bus stop, and I _probably_ would do that
if I knew where you were going -- The OP just asked whether there
was a way to clear the screen except outputting newline characters,
and there isn't). See the point?

Anyway...

Victor


I agree with you. But if you tell me that you cannot give me a lift to a
thown a thousand kilometers away doesnt mean that you should tell me that
there is no way I can go to that town. Thats what the other person did.


No. Using the same analogy, the other person told you that you
can't get to another town in Victor's car. He didn't say that
clearing of the screen cannot be done. He said that clearing of
the screen cannot be done with C++. Get it?
He
said that C++ cannot...
And you think that C++ can? Show me.
I am not saying that he or you HAVE to guide the OP
to an appropriate newsgroup, its voluntary ofcourse, but dont MISguide him
saying that it cannot be done. Get it?


Do you understand the difference between "it cannot be done" and
"it cannot be done using C++ means"? Saying the latter does NOT
imply the former, and in no way is misguiding. Get it?
Jul 19 '05 #9

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote in message
news:bd************@ID-75446.news.dfncis.de...

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vf************@corp.supernews.com...
"Ashish" <as*****@hotmail.com> wrote...
>
> "Victor Bazarov" <v.********@attAbi.com> wrote in message
> news:vf************@corp.supernews.com...
> > "Ashish" <as*****@hotmail.com> wrote...
> > >
> > > "Unforgiven" <ja*******@hotmail.com> wrote in message
> > > news:bd************@ID-136341.news.dfncis.de...
> > > > Tim Mierzejewski wrote:
> > > > > How do I clear the text from my screen, other than a bunch of
\n's
> or
> > > > > endl's?
> > > >
> > > > C++ can not clear the screen, as indicated in the FAQ Victor

pointed
> you
> > > to.
> > >
> > > Huh? C++ can do a lot of things using the OS specific libraries.

Dont
> say
> > > C++ cannot clear the screen. Instead, you should say standard
C++ cannot
> > > clear the screen.
> >
> > That's the only C++ we speak of here.
> >
> >
>
> Thats what I said too... but dont misguide the OP by saying that C++
cannot

Misguide?

> do this, or can do that. Guide him to an appropriate newsgroup. I am

sure
> you understand that.

But in all honesty, C++ cannot clear the screen. It's some OS-
specific library call that does that. Or sequence of characters
output to console or ... But it is not a language thing. And,
by the way, while there exist extensions to the language created
by some eager compiler vendors, there is only one C++ -- Standard.

That's what we mean when we say "C++ cannot do that". Another
example: can C++ read files? Yes. Can C++ read JPEG files? Yes.
Can C++ read and display JPEG files? NO. Displaying them is not
a language feature. C++ cannot do that. Not standard, not any
other C++. The same with clearing the screen.

Guiding others to a particular newsgroup is a voluntary thing. If
you stop me in the street and ask whether I could give you a lift
to a town a thousand kilometres away, I'll probably say "No, sorry,
I cannot do that", but I am not obligated to explain to you all
possible options you have or direct you to a bus station. It is
up to you to figure that out. (Of course it might be mighty kind
of me to point you to a bus stop, and I _probably_ would do that
if I knew where you were going -- The OP just asked whether there
was a way to clear the screen except outputting newline characters,
and there isn't). See the point?

Anyway...

Victor


I agree with you. But if you tell me that you cannot give me a lift to a
thown a thousand kilometers away doesnt mean that you should tell me

that there is no way I can go to that town. Thats what the other person did.


No. Using the same analogy, the other person told you that you
can't get to another town in Victor's car. He didn't say that
clearing of the screen cannot be done. He said that clearing of
the screen cannot be done with C++. Get it?
He
said that C++ cannot...


And you think that C++ can? Show me.
I am not saying that he or you HAVE to guide the OP
to an appropriate newsgroup, its voluntary ofcourse, but dont MISguide him saying that it cannot be done. Get it?


Do you understand the difference between "it cannot be done" and
"it cannot be done using C++ means"? Saying the latter does NOT
imply the former, and in no way is misguiding. Get it?


Oh, why am I arguing with you anyways? I reinstalled my OS and lost all the
news and email filters. Time to ignore you and Dan Poop again. Goodbye.
Jul 19 '05 #10


Ashish wrote:
Oh, why am I arguing with you anyways? I reinstalled my OS and lost all the
news and email filters. Time to ignore you and Dan Poop again. Goodbye.

Is there some reason you had three screens worth of quotes for this tiny
reply?

Brian Rodenborn
Jul 19 '05 #11

"Default User" <fi********@company.com> wrote in message
news:3E***************@company.com...


Ashish wrote:
Oh, why am I arguing with you anyways? I reinstalled my OS and lost all the news and email filters. Time to ignore you and Dan Poop again. Goodbye.

Is there some reason you had three screens worth of quotes for this tiny
reply?


Yes. A couple of reasons actually. First, it has become an off-topic thread
and anyone who cares to read off-topic posts should probably take the
efforts to scroll down to the bottom. Second, I am too lazy.
--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com http://www.softwarefreaks.com
Jul 19 '05 #12
On Fri, 27 Jun 2003 13:30:17 -0400, "Ashish" <as*****@hotmail.com>
wrote in comp.lang.c++:

"Unforgiven" <ja*******@hotmail.com> wrote in message
news:bd************@ID-136341.news.dfncis.de...
Tim Mierzejewski wrote:
How do I clear the text from my screen, other than a bunch of \n's or
endl's?


C++ can not clear the screen, as indicated in the FAQ Victor pointed you

to.

Huh? C++ can do a lot of things using the OS specific libraries. Dont say
C++ cannot clear the screen. Instead, you should say standard C++ cannot
clear the screen.


I guarantee you that I can show you several systems where C++,
standard or not, cannot clear the screen. For the simple reason that
there IS NO SCREEN. One of the reasons C++ does not support a screen
is that it does not require one.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Jul 19 '05 #13

"Jack Klein" <ja*******@spamcop.net> wrote in message
news:sr********************************@4ax.com...
On Fri, 27 Jun 2003 13:30:17 -0400, "Ashish" <as*****@hotmail.com>
wrote in comp.lang.c++:

"Unforgiven" <ja*******@hotmail.com> wrote in message
news:bd************@ID-136341.news.dfncis.de...
Tim Mierzejewski wrote:
> How do I clear the text from my screen, other than a bunch of \n's or > endl's?

C++ can not clear the screen, as indicated in the FAQ Victor pointed
you to.

Huh? C++ can do a lot of things using the OS specific libraries. Dont say C++ cannot clear the screen. Instead, you should say standard C++ cannot
clear the screen.


I guarantee you that I can show you several systems where C++,
standard or not, cannot clear the screen. For the simple reason that
there IS NO SCREEN. One of the reasons C++ does not support a screen
is that it does not require one.


I am sorry, I had put my statement wrongly. But, since the OP asked about
clearing the screen, I assumed he had a screen (a computer monitor).
--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com http://www.softwarefreaks.com
Jul 19 '05 #14
you do not want to use process.h since it is not platform independant,
use stdlib.h instead

regards

pol jak

Unforgiven wrote:
Tim Mierzejewski wrote:
How do I clear the text from my screen, other than a bunch of \n's or
endl's?

C++ can not clear the screen, as indicated in the FAQ Victor pointed you to.
However, you can ask the OS to do it for you. The most common ways to do
this are 'system("cls");' in Windows and system("clear");' in Linux. The
system function is defined in <process.h>


Jul 19 '05 #15
> Is there some reason you had three screens worth of quotes for this tiny
reply?


Laziness.

I hate the griping about top posting in the newsgroup (which is a heinous
crime IMO and come the revolution, top-posters will be second against the
wall to be shot with me in the role of executioner).

But some people who gripe against top-posters commit the equally henious
crime of not pruning old conversation. Why should I have to download reams
of old conversation and then scroll through it just to see a reply? IMO they
are more guilty than top-posters (and again, come the revolution,
non-pruners will be first against the wall to be shot with me in the role of
executioner).

Stephen Howe
Jul 19 '05 #16
> I guarantee you that I can show you several systems where C++,
standard or not, cannot clear the screen. For the simple reason that
there IS NO SCREEN. One of the reasons C++ does not support a screen
is that it does not require one.


I agree with you. But lets go further...

Equally I can show you systems where there is NO SUCH THING AS A FILE. So
why does both C and C++ provide stdio/streams? That is an OS thing and IMO,
should be removed.

Also the assumption that dynamic memory is available via new/malloc() should
be removed. That also is an OS thing and IMO should be removed.

Stephen Howe
Jul 19 '05 #17

"Stephen Howe" <SP*******************@tnsofres.com> wrote in message
news:3e***********************@reading.news.pipex. net...
Is there some reason you had three screens worth of quotes for this tiny
reply?
Laziness.

I hate the griping about top posting in the newsgroup (which is a heinous
crime IMO and come the revolution, top-posters will be second against the
wall to be shot with me in the role of executioner).

But some people who gripe against top-posters commit the equally henious
crime of not pruning old conversation. Why should I have to download reams
of old conversation and then scroll through it just to see a reply? IMO

they are more guilty than top-posters (and again, come the revolution,
non-pruners will be first against the wall to be shot with me in the role of executioner).


No problem.... here I am, shoot me, spam my email address, hack my website,
DOS attack my webserver and do whatever you feel like.
I visit this newsgroup for advise and sometimes even help others. I dont
like top posters and non-pruners too. But when people weep over not pruning
posts in some stupid off topic post, it pisses me off. Please dont read this
message, it has nothing to do with C++.

-A

Jul 19 '05 #18


Ashish wrote:

"Default User" <fi********@company.com> wrote in message
news:3E***************@company.com...

Is there some reason you had three screens worth of quotes for this tiny
reply?


Yes. A couple of reasons actually. First, it has become an off-topic thread
and anyone who cares to read off-topic posts should probably take the
efforts to scroll down to the bottom. Second, I am too lazy.


Neither is a good excuse.

1. We can't really rail at the top-posters when people validate their
point by failing to edit the quotes down to a reasonable subset. If a
post is worth responding to, it's worth taking the time to do it
correctly. If not, then the better solution is to not reply at all. The
fact that it was OT does not matter.

2. I find it difficult to believe that it was that much work. I used to
use trn with vi as the editor, yet always managed to trim quotes. You
use a windows based newsreader, where you merely needed to drag down on
some text and hit delete.

Brian Rodenborn
Jul 19 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by NeoPhreak | last post: by
reply views Thread by Peter | last post: by
20 posts views Thread by ritchie | last post: by
4 posts views Thread by John | last post: by
reply views Thread by sajithamol | last post: by
9 posts views Thread by pbd22 | last post: by
5 posts views Thread by Kid Programmer | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.