Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

C++ Clear


  • Please log in to reply

#1
projectgonewrong

projectgonewrong

    New Member

  • Member
  • Pip
  • 1 posts
Okay like here is an example

#include<iostream>
using namespace std;
int main()
{
cout << "Hello";
}

that outputs hello obviously. but how do I clear it off the screen so it no longer displays hello

Really so when i add another output it wont still show hello above it.

Edited by projectgonewrong, 25 June 2006 - 07:05 PM.

  • 0

Advertisements


#2
Swandog46

Swandog46

    Malware Expert

  • Member
  • PipPipPipPip
  • 1,026 posts
  • MVP
This is platform dependent (not standard C++, which is platform independent). It will require a system or API call. In Windows you could use:

#include <stdlib.h>

system("cls");

In Unix/Linux you would use:
#include <stdlib.h>

system("clear");

  • 0

#3
Andyman111

Andyman111

    Member

  • Member
  • PipPip
  • 19 posts
Hello,
Have you tryed to start a new project (or whatever your's is called)?
If thats the case it will ask you if you wish to save it,then start a new window.

Hope that helps
Andrew
  • 0

#4
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts

Hello,
Have you tryed to start a new project (or whatever your's is called)?
If thats the case it will ask you if you wish to save it,then start a new window.

Hope that helps
Andrew


He's not talking about the program he uses to compile...he's talking about clearing the text on the prompt/shell
  • 0

#5
lilhawk2892

lilhawk2892

    Member

  • Member
  • PipPipPip
  • 128 posts
i tried doing this i couldnt figure it out i think it should happen automatically or someone could make an easy dll
  • 0

#6
Swandog46

Swandog46

    Malware Expert

  • Member
  • PipPipPipPip
  • 1,026 posts
  • MVP
See my post #2 above. This is platform-dependent. The code above will work for Windows or Linux respectively though it is very inefficient.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP