473,545 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear Screen in C using Dev C++

1 New Member
Hi Guys,
Am using Windows 2000 and Dev C++ to create C programs. I'm trying to use clear screen and other graphic functions such as positioning output on screen. Have seen some documents that suggest i use curses.h or system("clear") for clear screen, for example but all this has failed.
Jan 10 '07 #1
8 64523
123Coder
1 New Member
Hi Guys,
Am using Windows 2000 and Dev C++ to create C programs. I'm trying to use clear screen and other graphic functions such as positioning output on screen. Have seen some documents that suggest i use curses.h or system("clear") for clear screen, for example but all this has failed.
You must use CONIO2.H header file to use clrscr(); You can get this from devpak.org in the text console category. Get the CONIO library. This will add the Borland Clrscr(); function as well as Dev Cpp's standard Conio.h header file.
Goodluck! =)
Jan 27 '07 #2
rdallas
2 New Member
You can use the following C statement to clear your screen:

Expand|Select|Wrap|Line Numbers
  1. system("sh -c clear");
You are executing the sh shell program (usually /bin/sh) and having it execute the built-in "clear" command. You need to use the "-c" option to tell sh that the next option is a built-in command, not a file to be executed. See the man page on sh for more info.
Sep 21 '07 #3
rdallas
2 New Member
The previous post assumes you are using Unix. On Windows, you can clear the screen by using the "cls" command; there is no "clear" command on Windows. I was able to use the following code to clear the screen (command window) using Borland C++ 5.5.1 for Win32 on Windows XP:

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2.  
  3. int main( int argc, char *argv[] )
  4. {
  5.     system("cls");
  6. }
Sep 21 '07 #4
vinay khurana
1 New Member
A lot of try to clear the sacreen in a program of c using dev c++ on OS 7,but never works
Feb 3 '12 #5
JazibBahir
2 New Member
Now use this

clrscr();
Feb 4 '12 #6
sanjoy adhikary
1 New Member
i want a code using programm
Apr 7 '14 #7
Deepak5218
1 New Member
Use system("cls") including the stdlib.h in the begining of the programm...

See the example......


#include<stdio. h>
#include<conio. h>
#include<string .h>
#include<stdlib .h>
main()
{
char name[10]="Deepak";
char pass[20]="Sharma";
char uname[10],upass[20];
printf("======= =============== =LOGIN PANEL========== =============== ==\n");
printf("Usernam e : ");
scanf("%s",unam e);
printf("Passwor d : ");
scanf("%s",upas s);
system("cls");
if(strcmp(name, uname)||strcmp( pass,upass))
{
printf("\tACCES S DENIED\n\n");
printf("Enter a valid username and password...");
}
else
{

printf("\tACCES S GRANTED\n\n");
printf("Welcome %s, Happy to see you again :)",name);
}
getch();
}
Mar 4 '15 #8
riteshsuprchamp
1 New Member
please include stdlib.h file and then call system("cls") and enjoy.
#include<stdlib .h>

system("cls");
Sep 2 '15 #9

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

Similar topics

0
2771
by: Peter | last post by:
I am just trying to learn python, to use for some fairly basic command line utilities which will run in either Windows/DOS or Linux. I cannot find a platform neutral way of manipulating the screen. I don't want to do anything complex, but just:- 1. Clear the screen 2. Print a string at an arbitrary x,y position 3. Receive a single key...
20
8128
by: ritchie | last post by:
Hi, I am trying to clear the screen in my program. I am loking for something that will work on all compilers, especially Borland & MS Visual Studio 6. On Visual studio I used 'system("cls");' and this works fine but this won't work for Borland. On Borland I used 'clrscr() ' function and it worked ok, but not for Visual Studio.
4
25696
by: John | last post by:
Hi I have the following in a Perl script. I just want to "clear screen" but it does not work. I don't think I've got my client and server sides confused. Any ideas? <SCRIPT Language="JavaScript"> moveTo (0,0);
6
15642
by: andrewanderson | last post by:
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...
0
1605
by: sajithamol | last post by:
I have an Applet that has three buttons on it, one being a clear screen button. I have it setup right now so it draws a rectangle the size of the applet and fills it with the background color. But when it does that my other two buttons disappear until I mouse over them again. Is there a better way to clear screen or anyway for the buttons to show...
2
3787
by: owl | last post by:
and here I thought I was going to finally be able to change the world AND contribute back to python with my amazing clear screen extension - but I can't get it to work. ;( Copying from ZoomHeight.py and someone else's clever print suggestion: ------------------------------------------------- # My Clear extension: clear a window class...
9
19141
by: pbd22 | last post by:
Hi. Does anybody know how to issue a clear screen command like DOS "cls" in a telnet session? Thanks!
5
3458
by: Kid Programmer | last post by:
Hello guys. I was wondering how you can clear the screen in a java program. Here is the code for my program: import javax.swing.SwingUtilities; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.BorderFactory; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; public class GUI {
1
19646
by: sganeshsvk | last post by:
i want to clear the screen command prompt for mysql in windows XP... In linux we use (CTRL + L) for clear the screen in mysql prompt.... i already use this command ( \c ) then ( \! clear ) for clear screen in Mysql windows XP... Plz sir, i want reply must......
0
7478
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7410
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7668
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7773
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5984
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.