conio.h

textbackground in c

textbackground function is used to change of current background color in text mode. See available colors.

Declaration : void textbackground(int color);

Output: 
background color

textcolor in c

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

#include<stdio.h>

wherey in c

wherey function return current vertical cursor position.

Declaration :- int wherey();

wherex in c

wherex function return current horizontal cursor position.

Declaration :- int wherex();

gotoxy in c

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:

kbhit in c

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;
}

getche in c

getche function prompts the user to press a character and that character is printed on screen.

getch in c

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;
}

delline

delline function deletes the line containing the cursor and move all lines below it one line up.

clrscr in c

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;
}
Subscribe to RSS - conio.h
randomness