By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

how to clear screen in visual c++

P: 24
hi i would like to know what are the method to clear the comand window screen using visual c++ what are the codes to use? can anyone help me?

i want to clear the screen once an input is entered
example
once the name is keyed in it clears the screen and proceed to the next question.

this way can make the whole program neater and easier to look at.

thanks in advance!!
Feb 24 '07 #1
Share this Question
Share on Google+
6 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
hi i would like to know what are the method to clear the comand window screen using visual c++ what are the codes to use? can anyone help me?

i want to clear the screen once an input is entered
example
once the name is keyed in it clears the screen and proceed to the next question.

this way can make the whole program neater and easier to look at.

thanks in advance!!
There are several different ways to do this, from using the system command to using different libraries.

How "standard" do you want this program to be? (ie - are you using conio.h?)
Feb 24 '07 #2

P: 24
There are several different ways to do this, from using the system command to using different libraries.

How "standard" do you want this program to be? (ie - are you using conio.h?)
hi thanks for replying,

i've tried using void but its not clear screen its just space which makes it cool but not neat what is conio.h how do i use it can u give me an example how it works or any other way is easier?

thanks in advance
Feb 25 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
hi thanks for replying,

i've tried using void but its not clear screen its just space which makes it cool but not neat what is conio.h how do i use it can u give me an example how it works or any other way is easier?

thanks in advance
I'm not too sure if there is an implementation in conio.h - I was just curious as to how portable you wanted the program to be - a call using the 'system' command will take whatever your operating system's clear command happens to be, but will then not be portable to another type of OS.

Check out 'system()' and (I'm assuming you're using windows) try to google 'dos clear screen command'.
Feb 25 '07 #4

P: 1
hi, i tried conio.h then tried system("cls"); this doesn't work.... then tried also the stdlib.h but still not useful... kindly advice..

thanks,
eunice =)
Mar 21 '07 #5

sicarie
Expert Mod 2.5K+
P: 4,677
hi, i tried conio.h then tried system("cls"); this doesn't work.... then tried also the stdlib.h but still not useful... kindly advice..

thanks,
eunice =)
This is also operating system dependent - if you're on XP and running through command line, 'cls' should work, if you're using conio, there is another option available in there (I believe), and if you're in Linux, it's just 'clear'.
Mar 21 '07 #6

P: 1
hi, i tried conio.h then tried system("cls"); this doesn't work.... then tried also the stdlib.h but still not useful... kindly advice..

thanks,
eunice =)

hey try putting this #include <cstdlib> at the top of your program then use system("cls") and that should work
Mar 24 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.