You are here

Textheight and textwidth functions in c

Declarations :-

int textheight(char *string);
int textwidth(char *string);

textheight function returns the height of a string in pixels and textwidth function returns the width of a string in pixels.

C programming code

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
 
main()
{
  int gd = DETECT, gm, a, b;
  char arr[100];
 
  initgraph(&gd, &gm, "C:\\TC\\BGI");
 
  a = textheight("H");
  b = textwidth("H");
 
  sprintf(arr,"Textheight = %d Textwidth = %d",a,b);
  outtext(arr);
 
  getch();
  closegraph();
  return 0;
}