• Have Any Question?
  • contact@eitworld.com

Getdrivername() Function





getdrivername() function returns the name of the graphics-driver. The graphics-driver is loaded by the initgraph() function. You can learn about the graphics-driver and initgraph() function in detail in chapter Let’s Start.

char *getdrivername();
  • getdrivername returns a pointer to a string with the name of the currently loaded graphics driver by the initgraph() function.
  • For better understanding go through the program:

Program

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT, gm;

char *drivername;

char a[50];

initgraph(&gd,&gm,” “);

drivername=getdrivername();

sprintf(a,”The value of the current background color is %s”,getdrivername);

outtextxy(100,240,a);

getch();

closegraph();

}

The above program will display the name of graphic driver currently loaded by the initgraph function. getdrivername() function will return the name of graphics driver and store it into the character pointer drivername and at last program will display a message as given in the output:

Output

getdrivername



Real Time Web Analytics