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

Clear Screen in C using Dev C++

P: 1
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
Share this Question
Share on Google+
8 Replies


P: 1
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

P: 2
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

P: 2
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

P: 1
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

P: 2
Now use this

clrscr();
Feb 4 '12 #6

P: 1
i want a code using programm
Apr 7 '14 #7

P: 1
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("Username : ");
scanf("%s",uname);
printf("Password : ");
scanf("%s",upass);
system("cls");
if(strcmp(name,uname)||strcmp(pass,upass))
{
printf("\tACCESS DENIED\n\n");
printf("Enter a valid username and password...");
}
else
{

printf("\tACCESS GRANTED\n\n");
printf("Welcome %s, Happy to see you again :)",name);
}
getch();
}
Mar 4 '15 #8

P: 1
please include stdlib.h file and then call system("cls") and enjoy.
#include<stdlib.h>

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

Post your reply

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