Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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