Submitted by yogesh on Sun, 13/03/2011 - 12:27
textbackground function is used to change of current background color in text mode. See available colors.
Declaration : void textbackground(int color);
Submitted by yogesh on Sun, 13/03/2011 - 08:21
textcolor function is used to change the color of drawing text in c programs.
Declaration :- void textcolor(int color);
where color is an integer variable. For example 0 means BLACK color, 1 means BLUE, 2 means GREEN and soon. You can also use write appropriate color instead of integer. For example you can write textcolor(YELLOW); to change text color to YELLOW. But use colors in capital letters only.
C programming code to change text color
Submitted by yogesh on Sun, 13/03/2011 - 08:12
wherey function return current vertical cursor position.
Declaration :- int wherey();
Submitted by yogesh on Sun, 13/03/2011 - 08:02
wherex function return current horizontal cursor position.
Declaration :- int wherex();
Submitted by yogesh on Sat, 12/03/2011 - 21:53
gotoxy in c: gotoxy function places cursor at a desired location on screen i.e. we can change cursor position using gotoxy function.
Declaration : void gotoxy( int x, int y);
where (x, y) is the position where we want to place the cursor.
C programming code for gotoxy
#include<stdio.h>
#include<conio.h>
main()
{
int x, y;
x = 10;
y = 10;
gotoxy(x, y);
printf("C program to change cursor position.");
getch();
return 0;
}
Output:
Submitted by yogesh on Sat, 12/03/2011 - 21:36
kbhit in c: kbhit function is used to determine if a key has been pressed or not. To use kbhit function in your program you should include the header file "conio.h". If a key has been pressed then it returns a non zero value otherwise returns zero.
Declaration : int kbhit();
C programming code for kbhit
#include <stdio.h>
#include <conio.h>
main()
{
while (!kbhit())
printf("You haven't pressed a key.\n");
return 0;
}
Submitted by yogesh on Sat, 12/03/2011 - 21:17
getche function prompts the user to press a character and that character is printed on screen.
Submitted by yogesh on Sat, 12/03/2011 - 20:56
getch in c language: getch function prompts the user to press a character and that character is not printed on screen, getch header file is conio.h.
C programming code for getch
/* getch in c example */
#include<stdio.h>
#include<conio.h>
main()
{
printf("Waiting for a character to be pressed from the keyboard to exit.\n");
getch();
return 0;
}
Submitted by yogesh on Sat, 12/03/2011 - 20:47
delline function deletes the line containing the cursor and move all lines below it one line up.
Submitted by yogesh on Sat, 12/03/2011 - 19:36
clrscr function clears the screen amd move the cursor to upper left hand corner of screen.
C programming code for clrscr
#include<stdio.h>
#include<conio.h>
main()
{
printf("Press any key to clear the screen.\n");
getch();
clrscr();
printf("This appears after clearing the screen.\n");
printf("Press any key to exit...\n");
getch();
return 0;
}