textwidth() function in C
The header file graphics.h contains textwidth () function which returns the width of input string in pixels.
Syntax :
int textwidth(char *string);
Example :
Input : string = "Hello Geek ! Have a good day."
Output :
Below is the implementation of textwidth() function.
#include <graphics.h>
#include <stdio.h>
int main()
{
int gd = DETECT, gm, color, width;
char arr[100];
initgraph(&gd, &gm, "" );
width = textwidth( "Hello Geek ! Have a good day." );
sprintf (arr, "Textwidth is = %d" , width);
outtext(arr);
getch();
closegraph();
return 0;
}
|
Output :
Last Updated :
23 Jan, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...