You are here

outtext and outtextxy functions

Declarations:
void outtext(char *string);
void outtextxy(int x, int y, char *string);

These functions are used to display text on the screen in graphics mode. Function outtext displays text at the current position while outtextxy displays text at the specified coordinates (x, y) on the screen.

C programming code

  1. #include<graphics.h>
  2. #include<conio.h>
  3.  
  4. int main()
  5. {
  6.    int gd = DETECT, gm;
  7.    
  8.    initgraph(&gd,&gm,"C:\\TC\\BGI");
  9.    
  10.    outtext("To display text at a particular position on the screen use outtextxy");
  11.    outtextxy(100, 100, "Hi There");
  12.    
  13.    getch();
  14.    closegraph();
  15.    return 0;
  16. }

Note : Do not use printf, gotoxy and other textmode functions in graphics mode. Do not use escape sequences such as '\n','\t' etc in outtext and outtextxy functions as they are meant to be used in textmode.