Function 'clrscr' (works in Turbo C++ compiler only) clears the screen and moves the cursor to the upper left-hand corner of the screen. If you are using the GCC compiler, use system function to execute the clear/cls command.
Jun 17, 2004 Dev C Clear Screen I just downloaded Dev c because the complier i was using (TC LITE) didn't allow me to make exe files. It also wasn't windows based which is. Clrscr in C Function 'clrscr' (works in Turbo C compiler only) clears the screen and moves the cursor to the upper left-hand corner of the screen. If you are using the GCC compiler, use system function to execute the clear/cls command. 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.
C programming code for clrscr
#include<stdio.h>- Clear Output Screen using C program. Clear Output Screen - When we run a program, previous output or other command prompt/ Linux Terminal command's output appear there. We can clear the output screen using C program. Functions which are used to clear output screen depend on the compiler, commonly used functions/methods are.
- I can issue the clear command or press Ctrl + L to clear the current Ubuntu terminal, but this just shifts previous output upwards and if you use mouse scroll or PgUP and PgDown keys it's hard to distinguish where the output of previous command ends and output of current command begins. Is there a way to really clear the terminal so I won't see previous command results?
#include<conio.h>
int main()
{
printf('Press any key to clear the screen.n');
getch();
clrscr();
We repair domestic and foreign vehicles and are your best choice for scheduled maintenance of your car, SUV, truck and fleet vehicles.Family owned and operated and we use the latest diagnostic equipment to guarantee your vehicle is serviced correctly while maintaining your manufacturer's warranty. Welcome to Precision Auto Repair & Towing, a full-service preventive maintenance and automotive repair center. Precision tune auto care in charlotte nc. We perform high quality, guaranteed service you can trust at a fair price.
printf('This appears after clearing the screen.n');
printf('Press any key to exit..n');
getch();
return0;
}
In the program, we display the message (Press any key to clear the screen) using printf and ask the user to press a key. When the user presses a key screen will be cleared and another message will be printed. Function clrscr doesn't work in Dev C++ compiler. Use the cleardevice function instead of clrscr in graphics mode.
Clear screen in C without using clrscr
#include <stdio.h>Dev C++ Clear Screen Command
#include <stdlib.h>
int main()
{
printf('Press any key to clear the screenn');
getchar();
Clear Screen Command Dev C Mac
system('clear');// For Windows use system('cls');
return0;
}