How to clear the console screen in C
When I was in college, my C instructor always insisted on clrscr() to clear the console screen. This works well on Borland compilers, but it doesn’t work on modern compilers like gcc. The reason behind this is that conio.h and clrscr() are not a part of the standard C language. conio.h is a custom library file created by Borland which is not present in gcc. If you use it, you will most probably get an error.
So how do we clear the console screen in C? Here is a solution:
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("cls"); /* Use 'clear' is *nix */
return 0;
}
First we #include <stdlib.h> and use the system() function. This function directly deals with the DOS emulator of Windows and clears the console using ‘cls’. It may be noted that ‘cls’ is a DOS command to clear the console.
If you are using *nix, you should use system(”clear”) as ‘clear’ is the command to clear the screen in *nix.
Ads
Free Movie Downloads
www.themorganranch.com - download movies off the internet.
How to Install Code::blocks in Ubuntu 8.04

Code::Blocks is a free C++ IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable. The main advantage of Code::blocks is that it works equally well on both Windows (2000, Xp or Vista) and Linux (for example: Ubuntu).
This is a brief how-to on installing Code::blocks on Ubuntu 8.04.
# Step 1) Download the binaries for Ubuntu from www.codeblocks.org/downloads/5. If you have a 32-bit computer (Pentium-III, IV, AMD Sempron, etc.) download the 32-bit version and if you have a 64-bit computer (AMD Athlon, etc.) download the 64-bit version. Save the file to your desktop.
# Step 2) Once the file has been downloaded, right click on it and extract the contents of the file. You will have files with .deb extension.
# Step 3) Now open a terminal, and navigate to the folder where the .deb files are located. You can do this by using the cd (change directory) command.
# Step 4) Once you are in the folder, type
sudo dpkg -i *.deb
at the command prompt.
Enter your password when you are prompted to. It usually takes a few minutes to install depending on your computer specs. Once the installation is complete without any errors, you can access it through the desktop menu.
To access Code::blocks, go to the menu and you will find it under “Programming”.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notepad++: An alternative to notepad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~